Moved numpad control to Tanshu.Common. Billing feature complete. Delete not working as expected
Signed-off-by: unknown <tanshu@.(none)>
This commit is contained in:
1 parent
eb05811868
commit
0f323f8fab
64 files changed
+2029
-1382
No files matched your search
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentNHibernate.Conventions;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Tanshu.Accounts.SqlDAO
|
||||
{
|
||||
public class CascadeConvention : IHasManyConvention, IReferenceConvention
|
||||
{
|
||||
public void Apply(IManyToOneInstance instance)
|
||||
{
|
||||
var property = instance.Property;
|
||||
|
||||
if (!HasAttribute(property.MemberInfo)) return;
|
||||
|
||||
Console.WriteLine("CascadeAll on {0}.{1}", property.DeclaringType.Name, property.Name);
|
||||
|
||||
instance.Cascade.All();
|
||||
}
|
||||
|
||||
public void Apply(IOneToManyCollectionInstance instance)
|
||||
{
|
||||
var property = instance.Member;
|
||||
|
||||
if (!HasAttribute(property)) return;
|
||||
|
||||
Console.WriteLine("CascadeAllDeleteOrphan on {0}.{1}", property.DeclaringType.Name, property.Name);
|
||||
|
||||
instance.Cascade.AllDeleteOrphan();
|
||||
}
|
||||
|
||||
bool HasAttribute(ICustomAttributeProvider provider)
|
||||
{
|
||||
return provider.GetCustomAttributes(typeof(CascadeAttribute), false).Length == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using FluentNHibernate.Conventions;
|
||||
using System.Reflection;
|
||||
using FluentNHibernate;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using FluentNHibernate.Conventions.Inspections;
|
||||
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Conventions
|
||||
{
|
||||
public class NotNullConvention : IPropertyConvention
|
||||
{
|
||||
public void Apply(IPropertyInstance instance)
|
||||
{
|
||||
if (!HasAttribute(instance.Property.MemberInfo)) return;
|
||||
instance.Not.Nullable();
|
||||
}
|
||||
bool HasAttribute(ICustomAttributeProvider provider)
|
||||
{
|
||||
return provider.GetCustomAttributes(typeof(NotNullAttribute), false).Length == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentNHibernate.Automapping;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using FluentNHibernate.Automapping;
|
||||
using FluentNHibernate.Cfg;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using Tanshu.Accounts.Conventions;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using FluentNHibernate.Conventions.Helpers;
|
||||
using Tanshu.Accounts.Conventions;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
|
||||
namespace Tanshu.Accounts.SqlDAO
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public sealed class SessionManager
|
||||
{
|
||||
@@ -33,6 +27,10 @@ namespace Tanshu.Accounts.SqlDAO
|
||||
{
|
||||
get { return Nested.sessionManager.GetSession(); }
|
||||
}
|
||||
public static IStatelessSession StatelessSession
|
||||
{
|
||||
get { return Nested.sessionManager.GetStatelessSession(); }
|
||||
}
|
||||
public static Configuration Configuration
|
||||
{
|
||||
get { return Nested.sessionManager.GetConfiguration(); }
|
||||
@@ -52,7 +50,9 @@ namespace Tanshu.Accounts.SqlDAO
|
||||
c.Add<PrimaryKeyConvention>();
|
||||
c.Add<CustomForeignKeyConvention>();
|
||||
c.Add<ClassConvention>();
|
||||
c.Add(DefaultLazy.Never());
|
||||
c.Add<CascadeConvention>();
|
||||
c.Add<NotNullConvention>();
|
||||
//c.Add(DefaultLazy.Never());
|
||||
//c.Add<EnumConvention>();
|
||||
});
|
||||
|
||||
@@ -66,5 +66,9 @@ namespace Tanshu.Accounts.SqlDAO
|
||||
{
|
||||
return factory.OpenSession();
|
||||
}
|
||||
public IStatelessSession GetStatelessSession()
|
||||
{
|
||||
return factory.OpenStatelessSession();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using Tanshu.Data.DAO;
|
||||
using FluentNHibernate.Automapping;
|
||||
using FluentNHibernate;
|
||||
using FluentNHibernate.Automapping;
|
||||
|
||||
namespace Tanshu.Accounts.SqlDAO
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public class StoreConfiguration : DefaultAutomappingConfiguration
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user