Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Vuscode.Framework.NHibernate.Conventions
- {
- using FluentNHibernate.Conventions;
- using FluentNHibernate.Conventions.Instances;
- public class DefaultStringPropertyConvention : IPropertyConvention
- {
- public void Apply(IPropertyInstance instance)
- {
- instance.Length(100);
- instance.Nullable();
- }
- }
- }
- namespace Vuscode.Framework.NHibernate.Conventions
- {
- using FluentNHibernate.Conventions;
- using FluentNHibernate.Conventions.Instances;
- public class DefaultBoolPropertyConvention : IPropertyConvention
- {
- public void Apply(IPropertyInstance instance)
- {
- instance.Not.Nullable();
- instance.Default("0");
- }
- }
- }
- public void Apply(IPropertyInstance instance)
- {
- if (instance.Type == typeof(bool))
- {
- instance.Not.Nullable();
- instance.Default("0");
- }
- }
- // or
- public class DefaultBoolPropertyConvention : IPropertyConvention, IPropertyConventionAcceptance
- {
- public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
- {
- criteria.Expect(i => i.Type == typeof(bool));
- }
- public void Apply(IPropertyInstance instance)
- {
- instance.Not.Nullable();
- instance.Default("0");
- }
- }
Add Comment
Please, Sign In to add comment