views:

176

answers:

2

I have created a Entity Framework mapping based on the book "Microsoft Entity Framework in Action". The OrderIT DB is available for download from the link. I am on VS 2010 RC and this is my first serious try of EF. But I keep getting an error

"Object reference not set to an instance of an object. Model.edmx"

I have broken the .edmx file into constituent ssdl, csdl and msl files and ran edmgen and it

gives me the same error as shown below. EdmGen /mode:ValidateArtifacts /incsdl:OrderIT.csdl /inssdl:OrderIT.ssdl /inmsl:OrderIT.msl

error 7001: Object reference not set to an instance of an object.

Validation Complete -- 1 errors, 0 warnings

Obviously something is wrong with the mapping but the error message gives me no details. Why I am getting this error and how to fix it ?

I have uploaded the relevant files here.

Update I did the whole thing again and this time marked the Company class as abstract. Looked like it is working now. It maybe this is the issue but I am not certain as I am new to EF in general.

A: 

Looks like you found a bug in the RC. You should report it here, as soon as possible.

That said, I'm not sure you actually need to do what you're trying to do. Can you explain what your goal is? For a simple case of using the EF, you should not have to run EdmGen manually.

Craig Stuntz
I just followed the book to do a mapping between entities and tables. I used VS to create EDM, deleted the auto created entities, created my own entities and manually re-mapped them, exactly as in the book. The VS error output shows me the error. I then used edmgen and got the same error. I guess VS is using edmgen internally and just reporting whatever error comes up.
Pratik
Deleting and manually re-mapping shouldn't be necessary.
Craig Stuntz
A: 

I made the Company class abstract and it build correctly. With my inexperience in EF and the error message not indicating any details I was stumped.

Pratik