This project is read-only.


Invalid association when trying to create an M2M-relationship involving composite keys involving a DateTime


First of all, thank you for creating and maintaining this project - this seems to be really useful! Why "seems"? Because I couldn't get it to work for my scenario for now:

I have two object, CourseDate and Student, where a course date can have many students and vice versa. The primary key of the CourseDate consists of a string and a DateTime property. The primary key of the Student is a simple long property. The linker table in the database therefore consists of those three columns.

When I build my according to the step-by-step guide my server side project compiles well, but the client side project fails providing the following error:
Association named 'CourseDate_CourseDateStudents' defined on entity type 'CourseManager2.Web.Data.CourseDate' is invalid: OtherKey property named 'Object1_DateTime_Id1' cannot be found on entity type 'CourseManager2.Web.Data.CourseDateStudent'. CourseManager2
When looking at the M2M sources - especially those of the LinkTable<> class these do not seem to support dates as part of the key. Is that correct? And if so - is there anything I can do about that?
Closed Jan 13, 2014 at 1:12 PM by MdeJ
issue is fixed


mrehrs wrote Jan 8, 2014 at 3:12 PM


thanks for the quick response! Looking forward to the fix!

best regards,
M. Rehrs

MdeJ wrote Jan 9, 2014 at 8:10 PM

I've added support for DateTime as primary key. I've created and pushed new nuget packages with this change.
Could you please try it out and let me know if this solves your issue.

Thanks in advance,

mrehrs wrote Jan 13, 2014 at 12:32 PM

Hi Merijn,

your fix works like a charm. Thanks a lot for fixing this that quick!

Best regards,

MdeJ wrote Jan 13, 2014 at 1:11 PM

Great, I'll close the issue