Friday 29 July 2011

C# Interview questions -- part 2

Following from my previous post, the last question I had was a MS Dynamics CRM question, which I did not get around to do. Essentially the problem was to create an entity called maet (team backwards) and another one called tluser (result backwards), you can see where this is going, to keep track of match results.
  • Maet had to have a name attribute only, the name of the maet.
  • Tluser had to display two maets and had to have a score attribute for each team and a result attribute (actually, I think it was a tluser attribute, but you get the picture).
The final task was to create a plugin, which I have forgotten what it was meant to do.

The only "tricky" thing here is what relationships are needed. Each tluser needs to show in its form two maets, thus we need to create two N:1 relationships between tluser and maet, in other words each maet can belong to N tlusers, which makes sense if you think about it. Each team is going to have several results, for each match it plays. As a rule of thumb the 1 entity shows up in the form of N entity (this is different for native N:N relationships, but I won't go into them).


Note that these relationships show as 1:N in the maet entity, as below.

At any rate, this is what I would have done, had I had the time to do it in. (Yes, I know it can be prettified, but that takes time).


There are loads of pitfalls with the way this is done, e.g. you could set both maets to be the same, or the result to field to be meaningless, but with a bit of time all of this can be sorted.

No comments:

Post a Comment