Entity framework is used to add methods to a model.

.net c# entity-framework orm

Question

Is it feasible to add methods to an object class using entity framework? For instance, I would want to add a "getAgeFromBirhDate" function to a CLIENT mapping.

1
16
5/30/2014 8:06:00 AM

Accepted Answer

Yes. It is doable. The output of Entity Framework is Split Classes.

This implies that everything will function properly even if you create another file with a different section of the Partial Class definition (including your new methods).

24
11/30/2010 2:56:50 PM

Popular Answer

Example of a first response

Suppose you have a thing calledFlower This may be used.partial class for including a method:

namespace Garden //same as namespace of your entity object
{
    public partial class Flower  
    {
        public static Flower Get(int id)
        { 
            //
        }
    }
}


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow