本文整理汇总了C#中ClassMap.DynamicComponent方法的典型用法代码示例。如果您正苦于以下问题:C# ClassMap.DynamicComponent方法的具体用法?C# ClassMap.DynamicComponent怎么用?C# ClassMap.DynamicComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassMap
的用法示例。
在下文中一共展示了ClassMap.DynamicComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyModel
private void VerifyModel(Action<DynamicComponentMapping> modelVerification)
{
var classMap = new ClassMap<PropertyTarget>();
var map = classMap.DynamicComponent(x => x.ExtensionData, m =>
{
m.Map(x => (string)x["Name"]);
m.Map(x => (int)x["Age"]);
m.Map(x => (string)x["Profession"]);
});
model.Add(classMap);
var generatedModels = model.BuildMappings();
var modelInstance = (DynamicComponentMapping)generatedModels
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(PropertyTarget)) != null)
.Classes.First()
.Components.Where(x => x is DynamicComponentMapping).First();
modelVerification(modelInstance);
}
示例2: Mapping
private void Mapping(Action<DynamicComponentPart<IDictionary>> mappingDefinition)
{
var classMap = new ClassMap<PropertyTarget>();
classMap.Id(x => x.Id);
var map = classMap.DynamicComponent(x => x.ExtensionData, m =>
{
m.Map(x => (string)x["Name"]);
m.Map(x => (int)x["Age"]);
m.Map(x => (string)x["Profession"]);
});
mappingDefinition(map);
mapping = classMap;
mappingType = typeof(PropertyTarget);
}
示例3: ShouldApplyToDynamicComponents
public void ShouldApplyToDynamicComponents()
{
var conventions = new[]
{
MockRepository.GenerateMock<IMappingPartConvention>()
};
var cm = new ClassMap<PropertyTarget>();
var dynamicComponent = cm.DynamicComponent(x => x.ExtensionData, c => { });
conventionFinder.Stub(x => x.Find<IMappingPartConvention>())
.Return(conventions);
conventions[0].Stub(x => x.Accept(null))
.IgnoreArguments()
.Return(true);
convention.Apply(cm);
conventions[0].AssertWasCalled(x => x.Apply(dynamicComponent));
}
开发者ID:HudsonAkridge,项目名称:fluent-nhibernate,代码行数:20,代码来源:ClassMappingPartDiscoveryConventionTester.cs