本文整理汇总了C#中CustomizersHolder.InvokeCustomizers方法的典型用法代码示例。如果您正苦于以下问题:C# CustomizersHolder.InvokeCustomizers方法的具体用法?C# CustomizersHolder.InvokeCustomizers怎么用?C# CustomizersHolder.InvokeCustomizers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomizersHolder
的用法示例。
在下文中一共展示了CustomizersHolder.InvokeCustomizers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvokeDirectMethods
public void InvokeDirectMethods()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var customizer = new CollectionElementCustomizer(propertyPath, customizersHolder);
var elementMapper = new Mock<IElementMapper>();
customizer.Length(10);
customizer.Precision(5);
customizer.Scale(2);
customizer.NotNullable(true);
customizer.Unique(true);
customizer.Column("pizza");
customizer.Type(NHibernateUtil.StringClob);
customizer.Type<MyUserType>();
var parameters = new {something= 10};
customizer.Type<MyUserType>(parameters);
customizer.Type(typeof(MyUserType), parameters);
customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object);
elementMapper.Verify(x => x.Length(It.Is<int>(v => v == 10)), Times.Once());
elementMapper.Verify(x => x.Precision(It.Is<short>(v => v == 5)), Times.Once());
elementMapper.Verify(x => x.Scale(It.Is<short>(v => v == 2)), Times.Once());
elementMapper.Verify(x => x.Unique(It.Is<bool>(v => v)), Times.Once());
elementMapper.Verify(x => x.NotNullable(It.Is<bool>(v => v)), Times.Once());
elementMapper.Verify(x => x.Column(It.Is<string>(v => v == "pizza")), Times.Once());
elementMapper.Verify(x => x.Type(It.Is<IType>(v => v.GetType() == NHibernateUtil.StringClob.GetType())), Times.Once());
elementMapper.Verify(x => x.Type<MyUserType>(), Times.Once());
elementMapper.Verify(x => x.Type<MyUserType>(It.Is<object>(v=> v == parameters)), Times.Once());
elementMapper.Verify(x => x.Type(It.Is<Type>(v=> v == typeof(MyUserType)), It.Is<object>(v => v == parameters)), Times.Once());
}
示例2: InvokeCustomizerOfDictionaryKeyManyToManyRelation
public void InvokeCustomizerOfDictionaryKeyManyToManyRelation()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyDictionary));
var customizersHolder = new CustomizersHolder();
var elementMapper = new Mock<IMapKeyManyToManyMapper>();
customizersHolder.AddCustomizer(propertyPath, (IMapKeyManyToManyMapper x) => x.Column("pizza"));
customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object);
elementMapper.Verify(x => x.Column(It.Is<string>(v => v == "pizza")), Times.Once());
}
示例3: InvokeCustomizerOfCollectionOneToManyRelation
public void InvokeCustomizerOfCollectionOneToManyRelation()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var elementMapper = new Mock<IOneToManyMapper>();
customizersHolder.AddCustomizer(propertyPath, (IOneToManyMapper x) => x.NotFound(NotFoundMode.Ignore));
customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object);
elementMapper.Verify(x => x.NotFound(It.Is<NotFoundMode>(v => v == NotFoundMode.Ignore)), Times.Once());
}
示例4: InvokeCustomizerOfCollectionElementRelation
public void InvokeCustomizerOfCollectionElementRelation()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var elementMapper = new Mock<IElementMapper>();
customizersHolder.AddCustomizer(propertyPath, (IElementMapper x) => x.Length(10));
customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object);
elementMapper.Verify(x => x.Length(It.Is<int>(v => v == 10)), Times.Once());
}
示例5: InvokeSetOfSchemaAction
public void InvokeSetOfSchemaAction()
{
var customizersHolder = new CustomizersHolder();
var customizer = new ClassCustomizer<MyClass>(customizersHolder);
var classMapper = new Mock<IClassAttributesMapper>();
customizer.SchemaAction(SchemaAction.None);
customizersHolder.InvokeCustomizers(typeof(MyClass), classMapper.Object);
classMapper.Verify(x => x.SchemaAction(SchemaAction.None));
}
示例6: MergeShouldMergeIdBagPropertiesMapper
public void MergeShouldMergeIdBagPropertiesMapper()
{
var emptyHolder = new CustomizersHolder();
var holder = new CustomizersHolder();
var called = false;
holder.AddCustomizer(propertyPath, (IIdBagPropertiesMapper x) => called = true);
emptyHolder.Merge(holder);
emptyHolder.InvokeCustomizers(propertyPath, (IIdBagPropertiesMapper)null);
Assert.That(called, Is.True);
}
示例7: MergeShouldMergeCollectionPropertiesMapper
public void MergeShouldMergeCollectionPropertiesMapper()
{
var emptyHolder = new CustomizersHolder();
var holder = new CustomizersHolder();
var called = false;
holder.AddCustomizer(propertyPath, (ICollectionPropertiesMapper x) => called = true);
emptyHolder.Merge(holder);
emptyHolder.InvokeCustomizers(propertyPath, (IBagPropertiesMapper)null);
called.Should().Be.True();
}
示例8: InvokeFilterMapping
public void InvokeFilterMapping()
{
var customizersHolder = new CustomizersHolder();
var customizer = new ClassCustomizer<MyClass>(customizersHolder);
var classMapper = new Mock<IClassAttributesMapper>();
var filterMapper = new Mock<IFilterMapper>();
classMapper.Setup(x => x.Filter(It.IsAny<string>(), It.IsAny<Action<IFilterMapper>>())).Callback<string, Action<IFilterMapper>>(
(name, x) => x.Invoke(filterMapper.Object));
customizer.Filter("pizza",x => x.Condition("any condition"));
customizersHolder.InvokeCustomizers(typeof(MyClass), classMapper.Object);
filterMapper.Verify(x => x.Condition(It.Is<string>(v => v == "any condition")));
}
示例9: InvokeOnDelete
public void InvokeOnDelete()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var customizer = new CollectionKeyCustomizer<MyClass>(propertyPath, customizersHolder);
var collectionMapper = new Mock<ISetPropertiesMapper>();
var keyMapper = new Mock<IKeyMapper>();
collectionMapper.Setup(x => x.Key(It.IsAny<Action<IKeyMapper>>())).Callback<Action<IKeyMapper>>(
x => x.Invoke(keyMapper.Object));
customizer.OnDelete(OnDeleteAction.Cascade);
customizersHolder.InvokeCustomizers(propertyPath, collectionMapper.Object);
keyMapper.Verify(x => x.OnDelete(It.Is<OnDeleteAction>(v => v == OnDeleteAction.Cascade)), Times.Once());
}
示例10: InvokeColumn
public void InvokeColumn()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var customizer = new CollectionKeyCustomizer<MyClass>(propertyPath, customizersHolder);
var collectionMapper = new Mock<ISetPropertiesMapper>();
var keyMapper = new Mock<IKeyMapper>();
collectionMapper.Setup(x => x.Key(It.IsAny<Action<IKeyMapper>>())).Callback<Action<IKeyMapper>>(
x => x.Invoke(keyMapper.Object));
customizer.Column("pizza");
customizersHolder.InvokeCustomizers(propertyPath, collectionMapper.Object);
keyMapper.Verify(x => x.Column(It.Is<string>(str => str == "pizza")), Times.Once());
}
示例11: InvokeColumnCustomizer
public void InvokeColumnCustomizer()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var customizer = new CollectionElementCustomizer(propertyPath, customizersHolder);
var elementMapper = new Mock<IElementMapper>();
var columnMapper = new Mock<IColumnMapper>();
elementMapper.Setup(x => x.Column(It.IsAny<Action<IColumnMapper>>())).Callback<Action<IColumnMapper>>(
x => x.Invoke(columnMapper.Object));
customizer.Column(c => c.SqlType("VARCHAR(100)"));
customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object);
columnMapper.Verify(x => x.SqlType(It.Is<string>(v => v == "VARCHAR(100)")));
}
示例12: InvokeCache
public void InvokeCache()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var customizer = new CollectionPropertiesCustomizer<MyClass, MyEle>(propertyPath, customizersHolder);
var collectionMapper = new Mock<ISetPropertiesMapper>();
var cacheMapper = new Mock<ICacheMapper>();
collectionMapper.Setup(x => x.Cache(It.IsAny<Action<ICacheMapper>>())).Callback<Action<ICacheMapper>>(
x => x.Invoke(cacheMapper.Object));
customizer.Cache(x=> x.Region("static"));
customizersHolder.InvokeCustomizers(propertyPath, collectionMapper.Object);
cacheMapper.Verify(x => x.Region(It.Is<string>(v => v == "static")));
}
示例13: InvokeIndex
public void InvokeIndex()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var customizer = new ListPropertiesCustomizer<MyClass, int>(propertyPath, customizersHolder);
var collectionMapper = new Mock<IListPropertiesMapper>();
var listIndexMapper = new Mock<IListIndexMapper>();
collectionMapper.Setup(x => x.Index(It.IsAny<Action<IListIndexMapper>>())).Callback<Action<IListIndexMapper>>(
x => x.Invoke(listIndexMapper.Object));
customizer.Index(x => x.Base(1));
customizersHolder.InvokeCustomizers(propertyPath, collectionMapper.Object);
listIndexMapper.Verify(x => x.Base(It.Is<int>(v => v == 1)));
}
示例14: InvokePropertyRef
public void InvokePropertyRef()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var customizer = new CollectionKeyCustomizer<MyClass>(propertyPath, customizersHolder);
var collectionMapper = new Mock<ISetPropertiesMapper>();
var keyMapper = new Mock<IKeyMapper>();
collectionMapper.Setup(x => x.Key(It.IsAny<Action<IKeyMapper>>())).Callback<Action<IKeyMapper>>(
x => x.Invoke(keyMapper.Object));
customizer.PropertyRef(x=> x.AProp);
customizersHolder.InvokeCustomizers(propertyPath, collectionMapper.Object);
keyMapper.Verify(x => x.PropertyRef(It.Is<MemberInfo>(v => v == ForClass<MyClass>.Property(p=> p.AProp))), Times.Once());
}
示例15: InvokeDirectMethods
public void InvokeDirectMethods()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var customizer = new OneToManyCustomizer(propertyPath, customizersHolder);
var elementMapper = new Mock<IOneToManyMapper>();
customizer.Class(typeof (Related));
customizer.EntityName("something");
customizer.NotFound(NotFoundMode.Ignore);
customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object);
elementMapper.Verify(x => x.Class(It.Is<Type>(v => v == typeof (Related))), Times.Once());
elementMapper.Verify(x => x.EntityName(It.Is<string>(v => v == "something")), Times.Once());
elementMapper.Verify(x => x.NotFound(It.Is<NotFoundMode>(v => v == NotFoundMode.Ignore)), Times.Once());
}