There are scenarios where we may want to add additional methods to an Entity class.
When we implement them we have to extend the Entity Data Model Class project by implementing a partial class in our Entity Project. We then create a data service and reference the EDM class project . You can add custom behaviors on WCF Data Services and expose the methods on the Entity Class.
Below are the steps that we need to take in order to consume a custom method added to our Entity class from our WCF Data Services.
Way to Do it!
Suppose we add below Method in our Entity Class
public partial class AdventureWorksEntities
public int contactid(stringfirstname)
AdventureWorksEntities aw = new AdventureWorksEntities();
Contact contact = (from c in aw.Contact where c.FirstName == firstname select c).FirstOrDefault<Contact>();
Note we have added a new class file to the Entity Project and expanded that class.