本文整理汇总了C#中AttributesMappingManager.GetFields方法的典型用法代码示例。如果您正苦于以下问题:C# AttributesMappingManager.GetFields方法的具体用法?C# AttributesMappingManager.GetFields怎么用?C# AttributesMappingManager.GetFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributesMappingManager
的用法示例。
在下文中一共展示了AttributesMappingManager.GetFields方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Inherited
public void Inherited() {
var m = new AttributesMappingManager();
var fields = m.GetFields(typeof (InheritedEntity));
Assert.AreEqual(3, fields.Count);
var uniqueKey = m.GetUniqueKey(typeof(InheritedEntity));
Assert.IsNotNull(uniqueKey);
Assert.AreEqual("Id", uniqueKey.FieldName);
}
示例2: DifferentTypes
public void DifferentTypes() {
var m = new AttributesMappingManager();
var key = m.GetUniqueKey(typeof(Entity));
Assert.IsNotNull(key);
Assert.IsNotNull(key.Property);
Assert.AreEqual("Id", key.Property.Name);
Assert.AreEqual("Id", key.FieldName);
var fields = m.GetFields(typeof (AnotherEntity));
Assert.AreEqual(1, fields.Count);
}
示例3: GetFields
public void GetFields() {
var m = new AttributesMappingManager();
var fields = m.GetFields(typeof (Entity)).Values;
Assert.AreEqual(2, fields.Count);
foreach (var f in fields) {
if (f.FieldName == "Id")
Assert.AreEqual("Id", f.Property.Name);
else if (f.FieldName == "desc")
Assert.AreEqual("Description", f.Property.Name);
else
Assert.Fail("Invalid field '{0}'", f.FieldName);
}
}
示例4: NoProperties_ShouldReturnEmpty
public void NoProperties_ShouldReturnEmpty()
{
var m = new AttributesMappingManager();
var fields = m.GetFields(typeof (NoProperties));
Assert.AreEqual(0, fields.Count);
}