new version of lujan99 template

NHibernate Forum

Postby daniellujan on Wed Jul 11, 2007 3:49 pm

I don't know... but I add in todo list your request.
daniellujan
Private First Class
 
Posts: 14
Joined: Tue Feb 27, 2007 12:54 pm
Location: Cordoba - Argentina

Postby vischari on Wed Jul 11, 2007 4:13 pm

Coool. As such your template looks great. Thanks for sharing it.

Those features will make your template usable for well normalized existing DB as well.

Here is the issue. In my project, we use 150 entities with 50 other look up entities. Some of the lookup entities have about 100 rows. Nhibernate by default uses fetch strategy of ' select ' , which issues 100 diferent select queries to sql server. It is causing a performance issue.

The features I mentioned earlier are very valuble to us. Once again thanks a lot for the template. This gives us a good starting point. I will try and tweak he template to fit my needs as much as I can.
vischari
Lurker
 
Posts: 3
Joined: Wed Jul 11, 2007 2:32 am

Code is not generated through the ZeusCmd.

Postby Eugene on Wed Mar 05, 2008 1:32 pm

Daniel,

For some reason i cannot generate source code through the ZeusCmd tool for your template. I prepared input file appropriately and got the following:
Code: Select all
C:\\Program Files\\MyGeneration13>zeuscmd -i sample_input.zinp
3/5/2008 3:24:41 PM Executing: NHibernate lujan99 - 1.0.6
3/5/2008 3:24:41 PM Successfully rendered Template: NHibernate lujan99 - 1.0.6


But no actual code was generated.

Could you tell me, please, where's the problem and how it could be solved.

Thanks in advance.
Eugene
Lurker
 
Posts: 1
Joined: Wed Mar 05, 2008 1:17 pm

Re: new version of lujan99 template

Postby Seipher on Wed Dec 24, 2008 4:24 pm

I just started using the template, it is exactly what I need right now so thanks for all your hard work.

I seem to have it partly working but I have a couple problems. First noticed that I had to change the repository constructor to:
Code: Select all
static Repository()
      {
         Configuration cfg = new Configuration().Configure();
         cfg.AddAssembly("AccountingManager.Model");
         factory = cfg.BuildSessionFactory();
         mysessions =  Thread.AllocateDataSlot();
      }

instead of,
Code: Select all
static Repository()
      {
         Configuration cfg = new Configuration();
         cfg.AddAssembly("AccountingManager.Model");
         factory = cfg.BuildSessionFactory();
         mysessions =  Thread.AllocateDataSlot();
      }

which was what it was initially generated. Without that change it won't read the cfg.xml file being used.

As and aside, it seems to me since the mapping files and the entity code are being generated from a specific database that a config file should be generated and used so that nHibernate uses that database. Or perhaps I am doing something wrong here.

The second problem I am having is I can't get it working with Lazy Loading enabled. I get this error every time I try to create a repository:

AccountingManager.UnitTest.GenerateSchema_Fixture.CanLoadDatabase:
System.TypeInitializationException : The type initializer for 'AccountingManager.Model.Repository' threw an exception.
----> NHibernate.InvalidProxyTypeException : The following types may not be used as proxies:
AccountingManager.Model.RepSplitCode: method remove_PropertyChanged should be virtual
AccountingManager.Model.CashRepSplit: method remove_PropertyChanged should be virtual
AccountingManager.Model.Account: method add_PropertyChanged should be virtual
AccountingManager.Model.Client: method add_PropertyChanged should be virtual
AccountingManager.Model.Policy: method add_PropertyChanged should be virtual
AccountingManager.Model.NonCashEntry: method add_PropertyChanged should be virtual
AccountingManager.Model.RepSplit: method add_PropertyChanged should be virtual
AccountingManager.Model.CashEntry: method add_PropertyChanged should be virtual
AccountingManager.Model.NonCashSplit: method remove_PropertyChanged should be virtual
AccountingManager.Model.CashEntry: method remove_PropertyChanged should be virtual
AccountingManager.Model.CashRepSplit: method add_PropertyChanged should be virtual
AccountingManager.Model.NonCashSplit: method add_PropertyChanged should be virtual
AccountingManager.Model.RepTable: method remove_PropertyChanged should be virtual
AccountingManager.Model.NonCashRepSplit: method add_PropertyChanged should be virtual
AccountingManager.Model.RepTable: method add_PropertyChanged should be virtual
AccountingManager.Model.NonCashEntry: method remove_PropertyChanged should be virtual
AccountingManager.Model.CashSplit: method add_PropertyChanged should be virtual
AccountingManager.Model.Account: method remove_PropertyChanged should be virtual
AccountingManager.Model.RepSplitCode: method add_PropertyChanged should be virtual
AccountingManager.Model.CashSplit: method remove_PropertyChanged should be virtual
AccountingManager.Model.RepSplit: method remove_PropertyChanged should be virtual
AccountingManager.Model.Policy: method remove_PropertyChanged should be virtual
AccountingManager.Model.Client: method remove_PropertyChanged should be virtual
AccountingManager.Model.NonCashRepSplit: method remove_PropertyChanged should be virtual


Any idea why this would happen?

I apologize in advance if my questions seems ignorant. I am new to both nHibernate and Mygeneration.
Seipher
Lurker
 
Posts: 1
Joined: Wed Dec 24, 2008 4:15 pm

Re: new version of lujan99 template

Postby ytian on Thu Apr 23, 2009 2:25 pm

Excellent job daniellujan. Could you add another 2 features to options:
1. Null Validation
if the table column is not null, then the property will check null in it's "setter".
2. Create partial classes
for example, if check this option, then for one "product" table, there will be 2 class files created. One is Product.Generated.cs, the other is Product.cs. Both of them contain class looks like below.
public partial class Product
{
.....
}
partial class in Product.Generated.cs has all the generated properties, and that in Product.cs is just an empty class for us to extend manually.
ytian
Lurker
 
Posts: 1
Joined: Thu Apr 23, 2009 2:11 pm

Previous

Return to NHibernate

Who is online

Users browsing this forum: No registered users and 0 guests

cron