Quantcast
Channel: EntityFramework Reverse POCO Code First Generator
Viewing all articles
Browse latest Browse all 1642

New Post: added isCreate_DefualtConstructor + isCreateFunction_InitializePartial

$
0
0
The idea was for you not to create the contructor, but for you to use the InitializePartial function to do your initialisation.
For example, taking Northind database, and setting
MakeClassesPartial = true;
This creates a class with the following:
[GeneratedCodeAttribute("EF.Reverse.POCO.Generator", "2.13.0.0")]
public partial class Order
{
    public int OrderId { get; set; } // OrderID (Primary key)
    ...blah blah blah...
        
    public Order()
    {
        Freight = 0m;
        OrderDetails = new List<OrderDetail>();
        InitializePartial();
    }

    partial void InitializePartial();
}
You create a class you want to override, say Order, with the following:
public partial class Order
{
    partial void InitializePartial()
    {
        // todo. Put your stuff in here.
        Freight = 12345.67m;
        ShipName = "demo";
        OrderDetails = null;
        // etc...
    }
}

Viewing all articles
Browse latest Browse all 1642

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>