views:

170

answers:

1

Hey there,

I want to know if there is way to create a database out of existing classes with the ado.net entity framework or to map existing classes to a database.

I looked for tutorials and only found ways to create the classes with the entity model designer.

As an example I have the class Bird with Properties Length and Age

On the database I have a table named Bird with columns Length and Age

Now I don't want the designer to create new classes out of the database. Instead I want to map the Class Bird directly to the table Bird. With Linq2Sql this was possible by creating the mapping manually. Is there a possibility in the ado.net entity framework?

With kind regards

Sebastian

A: 

What's the difference between mapping a class C onto a table T or mapping T onto a class C ?

O/R mapping isn't about mapping classes to tables, it's about defining an entity model and projecting it to tables AND classes simultaneously. After all, your classes and tables don't fall out of the sky: they're based on definitions you have, e.g. there has to be an entity customer, with fields A, B and C, and THEN you're defining the entity Customer with fields A, B and C which leads to a table Customer with fields A, B and C and a class Customer with fields / properties A, B and C and the mapping between them, because they represent the same entity

Frans Bouma
Sure you're right but with ado.net I found no solution for defining the mapping for my own purposes. The only possibility to create the entity model is out of the tables. Then classes are created but I want to create the mapping (or entity model) for myself, is there a possibility with ado.net?
Xelluloid
Not yet. EF v2 will get this feature, MS said. LLBLGen Pro v3 (out later this year) will also support EF and model first (what you want). (and what's with the -1? )
Frans Bouma
ah sorry for that, I misunderstood your answer and the last comment answered the question but I cannot change the -1 unless the post is edited ... =/ sorry but I am not so familiar with the system here
Xelluloid