Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Add associate / disassociate fake messages implementation #18

Closed
jordimontana82 opened this issue Jan 20, 2016 · 10 comments
Closed

Add associate / disassociate fake messages implementation #18

jordimontana82 opened this issue Jan 20, 2016 · 10 comments

Comments

@jordimontana82
Copy link
Owner

Although we can fake 1:N and N:1 relationships by just using EntityReference attributes with the current version of the framework, N:N relationships are created using a special Associate / Disassociate message from the OrganizationService and we don't have fake methods for these yet.

In order to keep it simple, we could just store an array of relationships in the XrmFakedContext, so that we could initialize the minimum set of relationships for each test.

public class XrmFakedContext {
...
   public Dictionary<string, XrmFakedRelationship> Relationships {get; set;}


...
}


public class XrmFakedRelationship {
   public string SchemaName {get;set;}
   public string EntityName {get;set;}  //of the many to many intersect entity

   //Entity name and attribute of the first entity participating in the relationship
   public string ReferencedEntityName1 {get;set;}   
   public string ReferencedEntityName2 {get;set;}

   //Entity name and attribute of the first entity participating in the relationship
   public string ReferencedAttributeName1 {get;set;}
   public string ReferencedAttributeName2 {get;set;}
}

So that when an Associate message is called, it needs to create new entries in the context for the EntityName involved in the N:N relationship as well as it needs to populate Entity References to the relevant entities. XrmFakedRelationship will be used to know which fields need to be updated.

@DigitalFlow
Copy link
Contributor

Hey @jordimontana82,

Will have a look on this :)
I was thinking about adding support for this the same day that you created the issue 👍

@jordimontana82
Copy link
Owner Author

Hah! @DigitalFlow

I started actually working on that on a local branch which I didn't push yet.... I could push the changes and you could take it from there?

@DigitalFlow
Copy link
Contributor

@jordimontana82: Sure!

@jordimontana82
Copy link
Owner Author

Sorry! I got confused for a while... I started working on a new branch for integration support. Feel free to add this stuff! :)

@jordimontana82
Copy link
Owner Author

Hey @DigitalFlow,

Wondering if you had a chance to look at this? :)

@DigitalFlow
Copy link
Contributor

Hey @jordimontana82,

I started some work on my fork, not ready for merge yet though.
Had not much time until now, but hopefully I'll be able to finish it soon.

@jordimontana82
Copy link
Owner Author

That's cool! Thank you!

El martes, 2 de febrero de 2016, DigitalFlow notifications@github.com
escribió:

Hey @jordimontana82 https://github.com/jordimontana82,

I started some work on my fork, not ready for merge yet though.
Had not much time until now, but hopefully I'll be able to finish it soon.


Reply to this email directly or view it on GitHub
#18 (comment)
.

@jordimontana82
Copy link
Owner Author

@DigitalFlow thx a lot for the contribution!

I added a call to your Associate/Disassociate Request Executors from the service.Associate and service.Disassociate methods too.

@DigitalFlow
Copy link
Contributor

Thx, forgot that as it seems. I submitted a new pull request though, which has some slight refactorings to the intersect entity schema name.

@jordimontana82
Copy link
Owner Author

No problem at all 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants