当前位置: 首页>>代码示例>>C#>>正文


C# CustomizersHolder类代码示例

本文整理汇总了C#中CustomizersHolder的典型用法代码示例。如果您正苦于以下问题:C# CustomizersHolder类的具体用法?C# CustomizersHolder怎么用?C# CustomizersHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CustomizersHolder类属于命名空间,在下文中一共展示了CustomizersHolder类的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());
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:32,代码来源:CollectionElementCustomizerTest.cs

示例2: InvokingCustomizerOnBagThenInvokeCollectionPropertiesCustomizer

        public void InvokingCustomizerOnBagThenInvokeCollectionPropertiesCustomizer()
        {
            var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
            var customizersHolder = new CustomizersHolder();
            var concreteCollectionMapper = new Mock<IBagPropertiesMapper>();

            customizersHolder.AddCustomizer(propertyPath, (ICollectionPropertiesMapper x) => x.BatchSize(10));
            customizersHolder.InvokeCustomizers(propertyPath, concreteCollectionMapper.Object);

            concreteCollectionMapper.Verify(x => x.BatchSize(It.Is<int>(v => v == 10)), Times.Once());
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:11,代码来源:CustomizersHolderTest.cs

示例3: 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());
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:11,代码来源:CustomizersHolderTest.cs

示例4: 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());
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:11,代码来源:CustomizersHolderTest.cs

示例5: 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());
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:11,代码来源:CustomizersHolderTest.cs

示例6: 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));
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:11,代码来源:ClassCustomizerTest.cs

示例7: MergeShouldMergeElementMapper

		public void MergeShouldMergeElementMapper()
		{
			var emptyHolder = new CustomizersHolder();
			var holder = new CustomizersHolder();
			var called = false;

			holder.AddCustomizer(propertyPath, (IElementMapper x) => called = true);
			emptyHolder.Merge(holder);
			emptyHolder.InvokeCustomizers(propertyPath, (IElementMapper)null);

			called.Should().Be.True();
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:12,代码来源:CustomizerHolderMergeTest.cs

示例8: 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);

			Assert.That(called, Is.True);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:12,代码来源:CustomizerHolderMergeTest.cs

示例9: 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")));
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:14,代码来源:ClassCustomizerTest.cs

示例10: WhenRegisteredCustomizerForDictionaryThenCallElementMapperAction

        public void WhenRegisteredCustomizerForDictionaryThenCallElementMapperAction()
        {
            var orm = GetBaseMockedDomainInspector();
            orm.Setup(x => x.IsDictionary(It.Is<MemberInfo>(m => m == ForClass<Person>.Property(p => p.Farm)))).Returns(true);
            bool customizerInvoked = false;
            var propertyPath = new PropertyPath(null, ForClass<Person>.Property(p => p.Farm));
            var customizersHolder = new CustomizersHolder();
            customizersHolder.AddCustomizer(propertyPath, (IOneToManyMapper x) => customizerInvoked = true);

            var mapper = new Mapper(orm.Object, customizersHolder);
            mapper.CompileMappingFor(new[] { typeof(Person) });

            customizerInvoked.Should().Be.True();
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:14,代码来源:OneToManyCustomizersInvocationTest.cs

示例11: 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());
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:15,代码来源:CollectionKeyCustomizerTest.cs

示例12: 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());
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:15,代码来源:CollectionKeyCustomizerTest.cs

示例13: 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")));
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:15,代码来源:CollectionPropertiesCustomizerTest.cs

示例14: 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)")));
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:15,代码来源:CollectionElementCustomizerTest.cs

示例15: 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)));
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:15,代码来源:ListPropertiesCustomizerTest.cs


注:本文中的CustomizersHolder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。