CRM Plugin configuration

There are quite a few ways to introduce configuration data into plugins:

1) unsecure/secure configuration

2) configuration entity

3) webservice.

There are pros and cons to each one of them, which one have you been using?

Posted in crm 2011, crm 4 | Leave a comment

EF:2 L2S:0

Another great thing about EF is the way m:m relationship is handled. It will recognize the bridge table between the two tables and will generate the m:m link in the EDMX model accordingly. This makes inserting a much simpler task and the code required a lot easier to read:

Tbl1 tbl1 = new Tbl1();
// populates the fields of tbl1
Tbl2 tbl2 = new Tbl2();
// populates the fields of tbl2

// associate the two tables
tbl1.Tbl2 = tbl2

ctx.Tbl1.AddObject(tbl1);
ctx.SaveChanges();

That’s it! No bridge table Ma!

More posts coming up on how to update and delete (equally easy, i promise!)

Posted in asp.net | Leave a comment

EF4: 1, L2S: 0

LINQ brings so much value to the table when it’s querying data. But when it comes time to doing the other 3 CRUD operations, things start to tangle up a bit. As simple as delete by PK, say a GUID, it have become cumbersome, and sometimes counter-intuitive.

The most intuitive way:

1) Query first (by PK)
2) Delete
3) ChangeOnSubmit

The less intuitive way (disconnected manner, ie. you know the PK you want to delete):

1) instantiate an object with only the PK value populated (the rest of the fields can be blank)
2) attach
3) DeleteOnSubmit

Adding to the fine subtlety, that only works in EF because it generates the following simple SQL:

delete tbl where pk_tbl = ‘@1’

In Linq to SQL, it generates:

delete tbl where pk_tbl = ‘@1’ and field1_tbl = ” and field2_tbl = ”…

So even if the rest of the fields are uninitialized with a value, they are included in the conditions… and of course, no deletion will take place. In fact it will give you an error saying that.

I’m leaning more and more to EF..

Posted in asp.net | Tagged | Leave a comment

Dynamics CRM Decision 2011

The 4 informational days of virtual conference dedicated for 4 products of MS Dynamics. Had some good discussions and made connections.

Posted in crm 2011, crm 4 | Tagged , | Leave a comment