Absolem Jackdaw
Primary key from object instead of a native
I'm making a school asignement and we have to use a personally made class called EmployeeNumber as a primary key.
I've tagged the field with [key] in the concerning class, but I keep getting the error that the EF can't find a primary key.
The following class (employeenumber) https://hatebin.com/temmimpnee
is a 'convertible' class, or should be, given the implicit operators.
To my knowledge this should constitute to EF that the class should be saved in the SQL Table as a String but it doesn't seem to recognize it?
Given the EmployeeConfiguration to equally define a key
https://hatebin.com/gfhbwbzahf
and the Employee class
https://hatebin.com/ilhlrjtuee
can anyone help me figure out why it doesnt take the primary key ?
most of this code is given by the assignment, so most questions about 'why did you do it this way' is probably answered with :'because the code was given to us this way : s '
I apologize in advance.
17 replies