dynamics crm 2011 - CRM development - early bound approach supporting multiple organizations -
we facing problem when develop crm library (manager) in c# support communication more 1 crm systems - i.e. situation when running more 1 crm instances @ once (e.g. 2 different organizations).
requirements crm library:
use early-bound instead of late-bound (because of type safety)
able communicate more crm systems (organizations) through 1 manager
only 1 method 1 operation (avoid code duplication) used crm systems (organizations) - necessary create utility parsing generated entity files (crmsvcutil tool) each organization. result of parsing list of interfaces , partial classes entities defined in entity files. interfaces implemented in partial classes according attributes contain, iaccountnumber etc. there 2 groups of interfaces - first 1 entity attributes common in both organization e.g. interface icrmaccount define accountnumber, name, address1 attributes etc. second group of interfaces attributes unique entity , not present in entity of crm systems (organizations). general crm manager offer methods communication, createaccount(), getaccount() etc. work specific crm system due implemented interfaces.
we have designed solution able communicate 2 different crm systems not able use implemented interfaces specific account, see enclosed solution contains comments of code.
the solution can found here:
description of solution:
crm_businesslogic - contains crmmanager holds methods communication , initialize correct data context in constructor
crm_interfaces - contains generated interfaces result of entity files parsing (this have done separate parsing tool). contains icrmaccount holding 1 attribute common both organizations , icrmcontext contains entity implemented in both data contexts - both contexts implementes same entity account.
crm_sceurope - contains generated entity file first crm organization sc europe - sceuropeentities.cs, generated data context parsing tool (implements list of interface according entities present in organization context) - sceuropecontext_generated , sceuropecontext.cs returns correct assembly
crm_sosw - same content crm_sceurope, contains data related second crm organization
crm_test - contains test console app communicate both organizations
please note enclosed solution contains account entity name parameter enough basic testing of designed solution.
important: before run of project have set credentials manager in program.cs file (crm_test project).
as can see if account data loaded crm using generated partial classes (soswcontext,sceuropecontext) implemented interface icrmcontext, application throws exception "invalid 'where' condition. entity member invoking invalid property or method - see method implementation.".
we appreciate if find solution how solve exception.
thanks
pavel
for current employer, have multiple crm organizations, identical, , able use exact same bound classes, 20 lines of custom code handle differences. other organizations not, , have separate dll organization specific namespace containing generated bound types. there no reason couldn't in same dll, you'll have issues if they're in same namespace, since each define it's own definition contact, appointment, etc.
just remember, can use bound types different org, long don't attempt select or update particular field or entity doesn't exist. if org 1 has companyid on contact entity, , org 2 doesn't, can still use bound types org 1, org 2, long don't populate companyid (ie place in entity parameters collection)
Comments
Post a Comment