本文整理汇总了C#中FluentNHibernate.MappingModel.PropertyMapping类的典型用法代码示例。如果您正苦于以下问题:C# PropertyMapping类的具体用法?C# PropertyMapping怎么用?C# PropertyMapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyMapping类属于FluentNHibernate.MappingModel命名空间,在下文中一共展示了PropertyMapping类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HasExplicitTypeConvention
private bool HasExplicitTypeConvention(Member property)
{
// todo: clean this up!
// What it's doing is finding if there are any IUserType conventions
// that would be applied to this property, if there are then we should
// definitely automap it. The nasty part is that right now we don't have
// a model, so we're having to create a fake one so the convention will
// apply to it.
var conventions = conventionFinder
.Find<IPropertyConvention>()
.Where(c =>
{
if (!typeof(IUserTypeConvention).IsAssignableFrom(c.GetType()))
return false;
var criteria = new ConcreteAcceptanceCriteria<IPropertyInspector>();
var acceptance = c as IConventionAcceptance<IPropertyInspector>;
if (acceptance != null)
acceptance.Accept(criteria);
var propertyMapping = new PropertyMapping
{
Member = property
};
propertyMapping.Set(x => x.Type, Layer.Defaults, new TypeReference(property.PropertyType));
return criteria.Matches(new PropertyInspector(propertyMapping));
});
return conventions.FirstOrDefault() != null;
}
开发者ID:nsreddy1986,项目名称:fluent-nhibernate,代码行数:31,代码来源:PropertyStep.cs
示例2: CanAddProperty
public void CanAddProperty()
{
var property = new PropertyMapping { Name = "Property1" };
compositeElementMapping.AddProperty(property);
compositeElementMapping.Properties.ShouldContain(property);
}
开发者ID:HudsonAkridge,项目名称:fluent-nhibernate,代码行数:7,代码来源:CompositeElementMappingTester.cs
示例3: CanAddProperty
public void CanAddProperty()
{
var property = new PropertyMapping { Name = "Property1" };
_classMapping.AddProperty(property);
_classMapping.Properties.ShouldContain(property);
}
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:7,代码来源:ClassMappingTester.cs
示例4: Should_not_write_the_default_access_type
public void Should_not_write_the_default_access_type()
{
var property = new PropertyMapping();
_writer.VerifyXml(property)
.DoesntHaveAttribute("access");
}
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:7,代码来源:HbmPropertyWriterTester.cs
示例5: CanAddProperty
public void CanAddProperty()
{
var property = new PropertyMapping();
property.Set(x => x.Name, Layer.Defaults, "Property1");
mapping.AddProperty(property);
mapping.Properties.ShouldContain(property);
}
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:8,代码来源:ClassMappingTester.cs
示例6: Should_write_the_specified_access_type
public void Should_write_the_specified_access_type()
{
var property = new PropertyMapping();
property.MemberAccess = MemberAccess.Create(AccessStrategy.Field, NamingStrategy.CamelCase);
_writer.VerifyXml(property)
.HasAttribute("access", "field.camelcase");
}
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:8,代码来源:HbmPropertyWriterTester.cs
示例7: PropertyInspector
public PropertyInspector(PropertyMapping mapping)
: base(mapping.Columns)
{
this.mapping = mapping;
propertyMappings.Map(x => x.LazyLoad, x => x.Lazy);
propertyMappings.Map(x => x.Nullable, "NotNull");
}
开发者ID:JonKruger,项目名称:fluent-nhibernate,代码行数:8,代码来源:PropertyInspector.cs
示例8: ShouldWriteColumns
public void ShouldWriteColumns()
{
var mapping = new PropertyMapping();
mapping.AddColumn(new ColumnMapping { Name = "Column1" });
writer.VerifyXml(mapping)
.Element("column").Exists();
}
开发者ID:sbakshi,项目名称:fluent-nhibernate,代码行数:9,代码来源:XmlPropertyWriterTester.cs
示例9: ExpectOnPropertyShouldValidateToTrueIfGivenMatchingModel
public void ExpectOnPropertyShouldValidateToTrueIfGivenMatchingModel()
{
acceptance.Expect(x => x.Insert, Is.Set);
var propertyMapping = new PropertyMapping();
propertyMapping.Set(x => x.Insert, Layer.Defaults, true);
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeTrue();
}
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:10,代码来源:PropertyAcceptanceCriteriaTests.cs
示例10: DefaultColumnShouldInheritColumnAttributes
public void DefaultColumnShouldInheritColumnAttributes()
{
var mapping = new PropertyMapping();
new PropertyBuilder(mapping, typeof(PropertyTarget), Prop(x => x.Name))
.Not.Nullable();
mapping.Columns.Defaults.First().NotNull.ShouldBeTrue();
mapping.Columns.First().NotNull.ShouldBeTrue();
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:10,代码来源:PropertyColumnDefaultsTester.cs
示例11: ShouldHaveDefaultColumnIfNoneSpecified
public void ShouldHaveDefaultColumnIfNoneSpecified()
{
var mapping = new PropertyMapping();
new PropertyBuilder(mapping, typeof(PropertyTarget), Prop(x => x.Name));
mapping.Columns.Defaults.Count().ShouldEqual(1);
mapping.Columns.UserDefined.Count().ShouldEqual(0);
mapping.Columns.Count().ShouldEqual(1);
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:10,代码来源:PropertyColumnDefaultsTester.cs
示例12: ExpectNotEqualShouldValidateToFalseIfNotGivenMatchingModel
public void ExpectNotEqualShouldValidateToFalseIfNotGivenMatchingModel()
{
acceptance.Expect(x => x.Insert != true);
var propertyMapping = new PropertyMapping();
propertyMapping.Set(x => x.Insert, Layer.Defaults, true);
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeFalse();
}
开发者ID:oblivious,项目名称:Oblivious,代码行数:10,代码来源:PropertyAcceptanceCriteriaEqualSimpleTypeEvalTests.cs
示例13: IsNotAnySucceedsIfNoValuesMatch
public void IsNotAnySucceedsIfNoValuesMatch()
{
acceptance.Expect(x => x.Access.IsNotAny(Access.Property, Access.Field));
var propertyMapping = new PropertyMapping();
propertyMapping.Set(x => x.Access, Layer.Defaults, Access.CamelCaseField().ToString());
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeTrue();
}
开发者ID:nsreddy1986,项目名称:fluent-nhibernate,代码行数:10,代码来源:PropertyAcceptanceCriteriaIsAnyTests.cs
示例14: ExpectNotEqualShouldValidateToFalseIfNotGivenMatchingModel
public void ExpectNotEqualShouldValidateToFalseIfNotGivenMatchingModel()
{
acceptance.Expect(x => x.Access != Access.Field);
var propertyMapping = new PropertyMapping();
propertyMapping.Set(x => x.Access, Layer.Defaults, "field");
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeFalse();
}
开发者ID:nsreddy1986,项目名称:fluent-nhibernate,代码行数:10,代码来源:PropertyAcceptanceCriteriaEqualComplexTypeTests.cs
示例15: ShouldHaveNoDefaultsIfUserSpecifiedColumn
public void ShouldHaveNoDefaultsIfUserSpecifiedColumn()
{
var mapping = new PropertyMapping();
new PropertyBuilder(mapping, typeof(PropertyTarget), Prop(x => x.Name))
.Column("explicit");
mapping.Columns.Defaults.Count().ShouldEqual(0);
mapping.Columns.UserDefined.Count().ShouldEqual(1);
mapping.Columns.Count().ShouldEqual(1);
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:11,代码来源:PropertyColumnDefaultsTester.cs
示例16: MultipleExpectsShouldValidateToFalseIfOnlyOneMatches
public void MultipleExpectsShouldValidateToFalseIfOnlyOneMatches()
{
acceptance.Expect(x => x.Insert, Is.Set);
acceptance.Expect(x => x.Update, Is.Set);
var propertyMapping = new PropertyMapping();
propertyMapping.Set(x => x.Insert, Layer.Defaults, true);
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeFalse();
}
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:11,代码来源:PropertyAcceptanceCriteriaTests.cs
示例17: CollectionIsNotEmptyShouldBeTrueWithItemsWhenUsingExpression
public void CollectionIsNotEmptyShouldBeTrueWithItemsWhenUsingExpression()
{
acceptance
.Expect(x => x.Columns.IsNotEmpty());
var mapping = new PropertyMapping();
mapping.AddColumn(new ColumnMapping { Name = "Column1" });
acceptance
.Matches(new PropertyInspector(mapping))
.ShouldBeTrue();
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:12,代码来源:PropertyAcceptanceCriteriaCollectionTests.cs
示例18: CollectionContainsWithStringShouldBeFalseWhenNoItemsMatching
public void CollectionContainsWithStringShouldBeFalseWhenNoItemsMatching()
{
acceptance
.Expect(x => x.Columns.Contains("boo"));
var mapping = new PropertyMapping();
mapping.AddColumn(new ColumnMapping { Name = "Column1" });
acceptance
.Matches(new PropertyInspector(mapping))
.ShouldBeFalse();
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:12,代码来源:PropertyAcceptanceCriteriaCollectionTests.cs
示例19: CollectionContainsWithLambdaShouldBeTrueWhenItemsMatching
public void CollectionContainsWithLambdaShouldBeTrueWhenItemsMatching()
{
acceptance
.Expect(x => x.Columns.Contains(c => c.Name == "Column1"));
var mapping = new PropertyMapping();
mapping.AddColumn(new ColumnMapping { Name = "Column1" });
acceptance
.Matches(new PropertyInspector(mapping))
.ShouldBeTrue();
}
开发者ID:heyitsanewb,项目名称:PokeWorld-Online,代码行数:12,代码来源:PropertyAcceptanceCriteriaCollectionTests.cs
示例20: CollectionIsEmptyShouldBeFalseWithItemsWhenUsingExpression
public void CollectionIsEmptyShouldBeFalseWithItemsWhenUsingExpression()
{
acceptance
.Expect(x => x.Columns.IsEmpty());
var mapping = new PropertyMapping();
mapping.AddColumn(Layer.Defaults, new ColumnMapping("Column1"));
acceptance
.Matches(new PropertyInspector(mapping))
.ShouldBeFalse();
}
开发者ID:jjchoi,项目名称:fluent-nhibernate,代码行数:12,代码来源:PropertyAcceptanceCriteriaCollectionTests.cs
注:本文中的FluentNHibernate.MappingModel.PropertyMapping类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论