How to work with Portable Class Library and EF Code-first?

Viewed 3047

I'm doing an Windows Phone app where I have a WebApi running in Azure.

I'm using the new "Portable Class Library" (http://msdn.microsoft.com/en-us/library/gg597391.aspx) for my "Models" project which is of cause shared between my WebApi project (this is a normale ASp.NET MVC 4 project) and my Windows Phone project.

This works great and the model (POCO) classes are serialized and deserialized just as I want.

Now I want to start storing some of my Models/POCO objects and would like to use EF Code-first for that, but that's kind of a problem as I can't add the EntityFramework assembly to my "Portable Class Library" project, and really I would not like to either as I only need a small part (the attributes) in my Models project.

So, any suggestions to how a approach this the best way?

UPDATE: Well, it seems like I can actually add the EntityFramework assembly to the project, but that doesn't really help me, as the attributes I need to use lives in System.ComponentModel.DataAnnotations which can't be used on Windows Phone. Any suggestions still?

3 Answers
Related