本文整理汇总了C#中FluentNHibernate.MappingModel.PropertyMapping.Set方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyMapping.Set方法的具体用法?C# PropertyMapping.Set怎么用?C# PropertyMapping.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluentNHibernate.MappingModel.PropertyMapping
的用法示例。
在下文中一共展示了PropertyMapping.Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MultipleExpectsShouldValidateToTrueIfGivenMatchingModel
public void MultipleExpectsShouldValidateToTrueIfGivenMatchingModel()
{
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);
propertyMapping.Set(x => x.Update, Layer.Defaults, true);
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeTrue();
}
示例2: AnyShouldValidateToTrueIfAllMatch
public void AnyShouldValidateToTrueIfAllMatch()
{
acceptance
.Any(c => c.Expect(x => x.Name, Is.Set),
c => c.Expect(x => x.Type, Is.Set),
c => c.Expect(x => x.Insert, Is.Set));
var propertyMapping = new PropertyMapping();
propertyMapping.Set(x => x.Name, Layer.Defaults, "Property1");
propertyMapping.Set(x => x.Type, Layer.Defaults, new TypeReference(typeof(string)));
propertyMapping.Set(x => x.Insert, Layer.Defaults, true);
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeTrue();
}
示例3: 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;
}
示例4: CanAddProperty
public void CanAddProperty()
{
var property = new PropertyMapping();
property.Set(x => x.Name, Layer.Defaults, "Property1");
mapping.AddProperty(property);
mapping.Properties.ShouldContain(property);
}
示例5: 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();
}
示例6: 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();
}
示例7: 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
示例8: GetPropertyMapping
private PropertyMapping GetPropertyMapping(Type type, Member property)
{
var mapping = new PropertyMapping
{
ContainingEntityType = type,
Member = property
};
var columnMapping = new ColumnMapping();
columnMapping.Set(x => x.Name, Layer.Defaults, property.Name);
mapping.AddColumn(Layer.Defaults, columnMapping);
mapping.Set(x => x.Name, Layer.Defaults, mapping.Member.Name);
mapping.Set(x => x.Type, Layer.Defaults, GetDefaultType(property));
SetDefaultAccess(property, mapping);
return mapping;
}
示例9: 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();
}
示例10: ExpectShouldEvaluateSubPropertyWithEvaluation
public void ExpectShouldEvaluateSubPropertyWithEvaluation()
{
acceptance.Expect(x =>
x.Type.Name == typeof(Record).Name);
var propertyMapping = new PropertyMapping
{
Member = ReflectionHelper.GetMember<Record>(x => x.Age),
};
propertyMapping.Set(x => x.Type, Layer.Defaults, new TypeReference(typeof(Record)));
acceptance.Matches(new PropertyInspector(propertyMapping))
.ShouldBeTrue();
}
开发者ID:nsreddy1986,项目名称:fluent-nhibernate,代码行数:13,代码来源:PropertyAcceptanceCriteriaEqualSubPropertyTests.cs
示例11: CanPassSubCriteriaToAny
public void CanPassSubCriteriaToAny()
{
var subCriteria1 = new ConcreteAcceptanceCriteria<IPropertyInspector>();
subCriteria1.Expect(x => x.Name, Is.Set);
var subCriteria2 = new ConcreteAcceptanceCriteria<IPropertyInspector>();
subCriteria2.Expect(x => x.Type, Is.Set);
acceptance.Any(subCriteria1, subCriteria2);
var propertyMapping = new PropertyMapping();
propertyMapping.Set(x => x.Name, Layer.Defaults, "Property1");
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeTrue();
}
示例12: IsNotAnyFailsIfAnyOfTheSuppliedValuesMatch
public void IsNotAnyFailsIfAnyOfTheSuppliedValuesMatch()
{
acceptance.Expect(x => x.Access.IsNotAny(Access.Property, Access.Field));
var propertyMapping = new PropertyMapping();
propertyMapping.Set(x => x.Access, Layer.Defaults, Access.Field.ToString());
var propertyMapping2 = new PropertyMapping();
propertyMapping2.Set(x => x.Access, Layer.Defaults, Access.Property.ToString());
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeFalse();
acceptance
.Matches(new PropertyInspector(propertyMapping2))
.ShouldBeFalse();
}
示例13: SetDefaultAccess
void SetDefaultAccess(Member member, PropertyMapping mapping)
{
var resolvedAccess = MemberAccessResolver.Resolve(member);
if (resolvedAccess != Access.Property && resolvedAccess != Access.Unset)
{
// if it's a property or unset then we'll just let NH deal with it, otherwise
// set the access to be whatever we determined it might be
mapping.Set(x => x.Access, Layer.Defaults, resolvedAccess.ToString());
}
if (member.IsProperty && !member.CanWrite)
{
mapping.Set(x => x.Access, Layer.Defaults, cfg.GetAccessStrategyForReadOnlyProperty(member).ToString());
}
}
示例14: CombinationOfSetAndNotSetShouldValidateToFalseWhenNoneMatch
public void CombinationOfSetAndNotSetShouldValidateToFalseWhenNoneMatch()
{
acceptance
.Expect(x => x.Insert, Is.Not.Set)
.Expect(x => x.Update, Is.Set);
var propertyMapping = new PropertyMapping();
propertyMapping.Set(x => x.Insert, Layer.Defaults, true);
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeFalse();
}
示例15: EitherIsAnyWithTwoParameters
public void EitherIsAnyWithTwoParameters()
{
acceptance
.Either(c => c.Expect(x => x.Name, Is.Set),
c => c.Expect(x => x.Type, Is.Set));
var propertyMapping = new PropertyMapping();
propertyMapping.Set(x => x.Name, Layer.Defaults, "Property1");
acceptance
.Matches(new PropertyInspector(propertyMapping))
.ShouldBeTrue();
}