本文整理汇总了C#中FluentNHibernate.MappingModel.PropertyMapping类的典型用法代码示例。如果您正苦于以下问题:C# PropertyMapping类的具体用法?C# PropertyMapping怎么用?C# PropertyMapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyMapping类属于FluentNHibernate.MappingModel命名空间,在下文中一共展示了PropertyMapping类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: CanAddProperty
public void CanAddProperty()
{
var property = new PropertyMapping { Name = "Property1" };
compositeElementMapping.AddProperty(property);
compositeElementMapping.Properties.ShouldContain(property);
}
示例3: CanAddProperty
public void CanAddProperty()
{
var property = new PropertyMapping { Name = "Property1" };
_classMapping.AddProperty(property);
_classMapping.Properties.ShouldContain(property);
}
示例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);
}
示例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");
}
示例8: ShouldWriteColumns
public void ShouldWriteColumns()
{
var mapping = new PropertyMapping();
mapping.AddColumn(new ColumnMapping { Name = "Column1" });
writer.VerifyXml(mapping)
.Element("column").Exists();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}