James
James

Reputation: 82136

ADO.NET Entity Framework: Best way of creating generic interface for business entities?

I am just getting started with the ADO.NET Entity Data Model and I was curious as to what was the best way of extending my entities behaviour.

Say I have a table called "Customers" and I create an entity model based on this table. I now have a "Customers" entity class. I want to now add some methods to this class and also make it implement an interface.

Should I directly change the code in the Designer.cs file, or should I inherit from Customers and do my extra work from there?

Any suggestions/advice would be great.

Thanks.

Upvotes: 2

Views: 789

Answers (1)

Rob
Rob

Reputation: 1328

Do not change the designer code. Entities creates partial classes so you can do something like this

public partial class Customer: IAmACoolInterface
{
 //implement stuff here



 }

Upvotes: 2

Related Questions