Automatically generate an instance of the nhib.pdf configuration file Tool
Ladies and gentlemen, many of my friends recently studied nhib.pdf have asked me how to use the tool that automatically generates the nhib.pdf configuration file.CodeFor more information, see.
Notes:
1. The configuration file I generated here is similar to the database field, so there is no complicated configuration page. After the configuration file is generated, you can modify it based on your own situation.
2. since the tool was implemented at nhibernate0.3 and there was no time to update it later, some features may be enhanced or modified in the current Nhibernate, however, I have been using the method for generating configuration, and it is okay in version 0.7. It can be used.
3. since nullabletype does not exist at the beginning of my project, the datetime type is used to determine whether it is less than 1753. If someone else uses nullabletype, modify it by yourself, if you want to retain datetime, I have modified the datetime part in nhib.pdf. Please modify it by yourself.
4. When no attribute is set, this tool considers each attribute as a common attribute. Therefore, set one-to-one, one-to-one, and other attributes.
Using system;
Using system. collections;
Using hr;
Using manhour;
Using HR. employee;
Using nhibernateattribute;
Using market;
Using contract;
Using common;
Using nhib.pdf;
Using HR. organizationunit;
Namespace Project
{
[Nhibernateclass]
Public class cproject: Common. cobject
{
/// ID attribute
[Nhibernateid]
Public guid guidproject
{
Get
{
Return this. mguidproject;
}
Set
{
This. mguidproject = value;
}
}
/// Common attributes
Public string name
{
Get
{
Return this. mname;
}
Set
{
This. mname = value;
}
}
[Nhibernateonetotify ("contract. ccontract", "marketmanage", keycolumn = "guidassigntoproject")]
Public ilist contracts
{
Get
{
Return this. mcontracts;
}
Set
{
This. mcontracts = value;
}
}
[Nhibernatemanytoone]
Public cmanhour custmerrebackmanhour
{
Get
{
Return mcustmerrebackmanhour;
}
Set
{
Mcustmerrebackmanhour = value;
}
}
[nhibernateonetoone]
Public cemployee PM
{< br> Get
{< br> return MPM;
}< br> set
{< br> MPM = value;
}< BR >}< br> [nhibernatemanyto.pdf ("contract. ccontract, contract "," guidrole ")]
Public ilist contracts
{< br> Get
{< br> If (this. mcontracts = NULL)
This. mcontracts = new arraylist ();
return this. mcontracts;
}< br> set
{< br> This. mcontracts = value;
}< BR >}