Reputation: 5848
I am looking at using some kind of Data Generation technology for my next project and was curious about the ADO.NET Entity Framework using Visual Studio 2010. I am new to the entity framework so please be gentle.
My preference for class naming has always been camel case. For example CustomerSite. My preference for database naming has always been lowercase with underscores. For example customer_site. This seems to be the norm over the last decade where I have worked with database administrators from many companies which is why I adopted this technique.
Using the entity framework to generate my classes, it always uses the table name, so my class name becomes customer_site. Which I hate.
I am mid-coding through a prototype, where the database has many tables (say around 40). At present, I have been working on my own Data Model, but I am sick of hand-coding fields and properties. It is a VB.NET WinForm application with standard CRUD for entities with vareious bells and whistles on top.
Is it possible to make the entity framework class generator use the naming convention of what I want or not? Or do I need to change my database naming conventions? Or just go with what the entity framework class generator gives me - customer_site as class name.
Any thoughts?
Thanks,
Andez
Upvotes: 0
Views: 785
Reputation: 7135
As mentioned in this question, you can set up mapping between your entities and your tables which enables you to have different table and class names. You can do this by overriding DbContext.OnModelCreating
, or by using the TableAttribute
.
I'd say if you're comfortable doing it you should stick to different naming conventions for your tables and entities.
Upvotes: 1