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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user