This idea has been around for a long time, and there is already a prototype version. I tentatively set it to fireasy. Data. entity.
Let me first talk about my idea. The ing of entities will be defined in the form of dependency attributes. This will avoid the use of reflection for object initialization, and it will also implement otherCode.
In this framework, the concepts of referencing entities and entity sets are provided. They can also be loaded through lazy. In addition, an attribute supporting enumeration and a synchronous attribute are also designed.
In addition, according to the needs of the actual project, the same object will be mapped to multiple different data tables according to different rules to provide distributed and isolated data storage. It also provides a tree structure ing and corresponding persistence classes to achieve quick application.
The inheritance feature of an object will be considered in the next phase.
The following is a sample code for object classes:
[Entitymapping ( " Products " )]
Public Class Product: entityobject
{
Public Readonly Static Iproperty _ productid = propertyunity. registerproperty ( " Productid " ,
Typeof ( Int ), Typeof (Product ),
New Propertymapinfo
{
Fieldname = " Productid " ,
Generatetype = identitygeneratetype. autoincrement,
Isprimarykey = True ,
Isnullable = False
});
Public Readonly Static Iproperty _ productname = propertyunity. registerproperty ( " Productname " ,
Typeof ( String ), Typeof (Product ),
New Propertymapinfo
{
Fieldname = " Productname " ,
Isnullable = False
});
Public readonly static iproperty _ supplierid = propertyunity. registerproperty ( " supplierid " ,
typeof ( int ?), typeof (product),
New propertymapinfo {fieldname = " supplierid " });
Public readonly static iproperty _ categoryid = propertyunity. registerproperty ( " categoryid " ,
typeof ( int ?), typeof (product),
New propertymapinfo {fieldname = " categoryid " });
Public readonly static iproperty _ quantityperunit = propertyunity. registerproperty ( " quantityperunit " ,
typeof ( string ), typeof (product),
New propertymapinfo {fieldname = " quantityperunit " });
Public readonly static iproperty _ unitprice = propertyunity. registerproperty ( " unitprice " ,
typeof ( decimal ?), typeof (product),
New propertymapinfo {fieldname = " unitprice " });
Public readonly static iproperty _ unitsinstock = propertyunity. registerproperty ( " unitsinstock " ,
typeof ( short ?), typeof (product),
New propertymapinfo {fieldname = " unitsinstock " });
Public readonly static iproperty _ unitsonorder = propertyunity. registerproperty ( " unitsonorder " ,
typeof ( short ?), typeof (product),
New propertymapinfo {fieldname = " reorderlevel " });
Public readonly static iproperty _ reorderlevel = propertyunity. registerproperty ( " reorderlevel " ,
typeof ( short ?), typeof (product),
New propertymapinfo {fieldname = " reorderlevel " });
Public readonly static iproperty _ discontinued = propertyunity. registerproperty ( " discontinued " ,
typeof ( bool ?), typeof (product),
New propertymapinfo {fieldname = " discontinued " , defaultvalue = true });
Public readonly static iproperty _ orderdetails = propertyunity. registerspecialproperty ( " orderdetails " ,
typeof (entityset ), typeof (product ));
Public readonly static iproperty _ delflag = propertyunity. registerproperty ( " delflag " ,
typeof ( bool ?), typeof (product), New propertymapinfo {fieldname = " del_flag " , isfakedeleteflag = true });
Public int productid
{< br> Get { return ( int ) getvalue (_ productid) ;}< br> set {setvalue (_ productid, value) ;}< BR >}
Public string productname
{< br> Get { return ( string ) getvalue (_ productname) ;}< br> set {setvalue (_ productname, value) ;}< BR >}
Public int ? Supplierid
{< br> Get {< span style = "color: # 0000ff "> return ( int ) getvalue (_ supplierid );}
set {setvalue (_ supplierid, value) ;}< BR >}
Public int ? Categoryid
{< br> Get { return ( int ) getvalue (_ categoryid );}
set {setvalue (_ categoryid, value) ;}< BR >}
Public string quantityperunit
{< br> Get { return ( string ) getvalue (_ quantityperunit) ;}< br> set {setvalue (_ quantityperunit, value) ;}< BR >}
Public decimal ? Unitprice
{< br> Get { return ( decimal ) getvalue (_ unitprice );}
set {setvalue (_ unitprice, value) ;}< BR >}
Public short ? Unitsinstock
{< br> Get { return (int16) getvalue (_ unitsinstock) ;}< br> set {setvalue (_ unitsinstock, value) ;}< BR >}
Public short ? Unitsonorder
{< br> Get { return (int16) getvalue (_ unitsonorder) ;}< br> set {setvalue (_ unitsonorder, value) ;}< BR >}
Public short ? Reorderlevel
{< br> Get { return (int16) getvalue (_ reorderlevel) ;}< br> set {setvalue (_ reorderlevel, value) ;}< BR >}
Public bool ? Discontinued
{< br> Get { return ( bool ) getvalue (_ discontinued );}
set {setvalue (_ discontinued, value) ;}< BR >}
Public entityset orderdetails
{< br> Get { return (entityset ) getvalue (_ orderdetails );}
set {setvalue (_ orderdetails, value) ;}< BR >}
Public Bool? Delflag
{
Get{Return(Bool) Getvalue (_ delflag );}
Set{Setvalue (_ delflag, value );}
}
}
Similar to EF, the relationship between entities is defined using the Assembly feature:
[Assembly: relationship ( " Product: orderdetails " , Typeof (Product ), Typeof (Orderdetails ), " Productid => productid " )]
[Assembly: relationship ( " Orders: orderdetails " , Typeof (Orders ), Typeof (Orderdetails ), " Orderid => orderid " )]
[Assembly: relationship ( " Customer: orders " , Typeof (Customers ), Typeof (Orders ), " Customerid => customerid " )]
The framework also provides support for LINQ queries. Currently, it supports MSSQL, Oracle, MySQL, and SQLite databases.
The current test results show that the data loading speed is a little faster than ef. Now you need to ask prawns to help verify the feasibility of this method. If you are interested, join the discussion and give me more comments. QQ group number: 6406277.