Added inverse Attribute to ProductGroup.
BillInventory Renamed. Refactored Bill to be more usable. Added Bill Detail Report. Added Open Bill and Bill Details Roles. Zero Rate Products have Yellow background Color. Refactored UserBI, FoodTableBI, ModifierBI, PrintLocationBI, ProductBI, ProductGroupBI, TaxBI, UserBI, Cached the Products List. Product and Product Group Form Working.
This commit is contained in:
@ -14,6 +14,10 @@ namespace Tanshu.Accounts.SqlDAO
|
||||
{
|
||||
return provider.GetCustomAttributes(typeof(CascadeAttribute), false).Length == 1;
|
||||
}
|
||||
public static bool Inverse(ICustomAttributeProvider provider)
|
||||
{
|
||||
return provider.GetCustomAttributes(typeof(InverseAttribute), false).Length == 1;
|
||||
}
|
||||
public static bool Unique(ICustomAttributeProvider provider)
|
||||
{
|
||||
return provider.GetCustomAttributes(typeof(UniqueAttribute), false).Length == 1;
|
||||
|
||||
19
Tanshu.Accounts.Repository/Fluent/InverseConvention.cs
Normal file
19
Tanshu.Accounts.Repository/Fluent/InverseConvention.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using FluentNHibernate.Conventions;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Tanshu.Accounts.SqlDAO
|
||||
{
|
||||
public class InverseConvention : IHasManyConvention //, IReferenceConvention
|
||||
{
|
||||
public void Apply(IOneToManyCollectionInstance instance)
|
||||
{
|
||||
var property = instance.Member;
|
||||
if (!AttributeChecker.Inverse(property)) return;
|
||||
Trace.TraceInformation("Inverse on {0}.{1}", property.DeclaringType.Name, property.Name);
|
||||
instance.Inverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentNHibernate.Conventions;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using NHibernate;
|
||||
using NHibernate;
|
||||
using NHibernate.SqlCommand;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
@ -19,10 +19,10 @@ namespace Tanshu.Accounts.Repository
|
||||
factory = cfg.BuildSessionFactory();
|
||||
}
|
||||
|
||||
//public static SessionManager Instance
|
||||
//{
|
||||
// get { return Nested.sessionManager; }
|
||||
//}
|
||||
public static void Initialize()
|
||||
{
|
||||
Nested.sessionManager.Init();
|
||||
}
|
||||
public static ISession Session
|
||||
{
|
||||
get { return Nested.sessionManager.GetSession(); }
|
||||
@ -58,6 +58,7 @@ namespace Tanshu.Accounts.Repository
|
||||
c.Add<UniqueConvention>();
|
||||
c.Add<NotNullConvention>();
|
||||
c.Add<FormulaConvention>();
|
||||
c.Add<InverseConvention>();
|
||||
//c.Add<AllowNullConvention>();
|
||||
c.Add<EnumConvention>();
|
||||
});
|
||||
@ -68,6 +69,8 @@ namespace Tanshu.Accounts.Repository
|
||||
.BuildConfiguration()
|
||||
.SetInterceptor(new NHSQLInterceptor());
|
||||
}
|
||||
private void Init()
|
||||
{ }
|
||||
private ISession GetSession()
|
||||
{
|
||||
return factory.OpenSession();
|
||||
|
||||
Reference in New Issue
Block a user