views:

26

answers:

2

Hi all,

I'm using entity framework designer to build entities. I found the designer really hard to use because it overwrite all your manually change after each model update using the designer. How did you round off this problem? Thanks!

A: 

What sorts of things are you manually changing? The entity still has to be mappable to the database schema.

You can extend or add functionality by declaring a partial class.

Don't make any change to the entities in the generated file -- I think it says that in the header.

All of the entities are generated as partial classes, which means you can declare "more" of the class elsewhere.

Here is an example:

public partial class Name
{
   public string First { get; set; }
}

public partial class Name
{
   public string Last { get; set; }
}

Although I have two different class declarations, potentially in different files and folders within the project, it gets compiled as one class.

I can now use the Name class like this:

var name = new Name();
name.First = "Jane";
name.Last = "Doe";

As you can see, the properties from both declarations are unified in an object of type Name.

To apply this to EF, leave the partial entity class alone, and declare a separate partial class with the same name to add functionality.

Jay
I don't want some of the lookup tables to be mapped as navigation property. So I removed those MSL CSDL content in the edmx.
Roy
A: 

There is an alternative third-party tool. For more information, refer to http://www.devart.com/entitydeveloper/producttour.html . Currently, Devart Entity Developer doesn't include the Update From Database functionality. The Update From Database feature is on our roadmap.

Devart