本文整理汇总了C#中ClassMapping类的典型用法代码示例。如果您正苦于以下问题:C# ClassMapping类的具体用法?C# ClassMapping怎么用?C# ClassMapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassMapping类属于命名空间,在下文中一共展示了ClassMapping类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TestCheckStoreRoomMissing
public void TestCheckStoreRoomMissing()
{
OleDbOracleDaLayer ddl =
new OleDbOracleDaLayer(
(OleDbDescriptor)
ConnectionDescriptor.LoadFromConfig(
new Config("..\\..\\Tests\\OracleDao.config", "OracleDaoConfig"), "DAO"));
// Make sure the store room to test does not exist
var colDef = new ClassMapColDefinition("Id", "Id", "INTEGER");
var cm = new ClassMapping("test", "UNITTEST.StoreroomDoesNotExist", new List<ClassMapColDefinition>{colDef}, false);
ddl.DeleteStoreRoom(cm);
try
{
// Hasn't been added yet, should not exist
Assert.IsTrue(
ddl.StoreRoomMissing(cm), "Oracle storeroom should not exist");
ddl.CreateStoreRoom(cm);
// Correct name, should exist
Assert.IsFalse(
ddl.StoreRoomMissing(cm), "Oracle Storeroom should exist");
}
finally
{
// Delete the storeromm, no matter what
ddl.DeleteStoreRoom(cm);
}
// Storeroom should be gone
Assert.IsTrue(
ddl.StoreRoomMissing(cm), "Oracle storeroom should not exist");
}
开发者ID:azavea,项目名称:net-dao-oledb,代码行数:35,代码来源:OracleDaoTests.cs
示例2: CreateSubclass
private ISubclassMapping CreateSubclass(ClassMapping mapping)
{
if (mapping.Discriminator == null)
return new JoinedSubclassMapping();
return new SubclassMapping();
}
开发者ID:JonKruger,项目名称:fluent-nhibernate,代码行数:7,代码来源:SeparateSubclassVisitor.cs
示例3: StoreRoomMissing
/// <summary>
/// Returns true if you need to call "CreateStoreRoom" before storing any
/// data. This method is "Missing" not "Exists" because implementations that
/// do not use a store room can return "false" from this method without
/// breaking either a user's app or the spirit of the method.
///
/// Store room typically corresponds to "table".
/// Firebird doesn't appear to support the SQL standard information_schema.
/// </summary>
/// <returns>Returns true if you need to call "CreateStoreRoom"
/// before storing any data.</returns>
public override bool StoreRoomMissing(ClassMapping mapping)
{
int count = SqlConnectionUtilities.XSafeIntQuery(_connDesc,
"select count(*) from rdb$relations where rdb$relation_name = '" +
mapping.Table.ToUpper() + "'", null);
return count == 0;
}
开发者ID:azavea,项目名称:net-dao-firebird,代码行数:18,代码来源:FirebirdDaLayer.cs
示例4: GetStream
public Stream GetStream(ClassMapping clazz,string directory,out string fileName)
{
directoryForOutput = directory;
if (!string.IsNullOrEmpty(directoryForOutput))
{
if (!Directory.Exists(directoryForOutput))
Directory.CreateDirectory(directoryForOutput);
}
try
{
fileName = GetFileName(clazz);
}
catch
{
fileName = clazz.GeneratedName + ".cs";
log.Error("Error processing template for file name. " + fileName + " used.");
}
string toSave = Path.Combine(directoryForOutput, fileName);
FileStream output = new FileStream(toSave, FileMode.Create, FileAccess.ReadWrite);
log.Debug("Flushing output on file:" + output.Name);
fileName = toSave;
return output;
}
开发者ID:spib,项目名称:nhcontrib,代码行数:26,代码来源:T4Render.cs
示例5: MemoryDataReader
/// <summary>
/// Create the data reader.
/// </summary>
/// <param name="layer">Layer creating it.</param>
/// <param name="mapping">Mapping for the class stored in the data store.</param>
/// <param name="criteria">Criteria for which instances you want.</param>
/// <param name="objects">Iterator over the list of objects.</param>
public MemoryDataReader(UnqueryableDaLayer layer, ClassMapping mapping, DaoCriteria criteria,
IEnumerator<MemoryObject> objects)
: base(layer, mapping, criteria, GetConfig(mapping))
{
_objects = objects;
PreProcessSorts();
}
开发者ID:azavea,项目名称:net-dao,代码行数:15,代码来源:MemoryDataReader.cs
示例6: ShouldMapByteArrayAsBinaryBlob
public void ShouldMapByteArrayAsBinaryBlob()
{
var mapping = new ClassMapping { Type = typeof(Target) };
mapper.Map(mapping, typeof(Target).GetProperty("Version"));
mapping.Version.Type.ShouldEqual(new TypeReference("BinaryBlob"));
}
开发者ID:JonKruger,项目名称:fluent-nhibernate,代码行数:8,代码来源:AutoMapVersionTester.cs
示例7: ShouldMapByteArrayAsNotNull
public void ShouldMapByteArrayAsNotNull()
{
var mapping = new ClassMapping { Type = typeof(Target) };
mapper.Map(mapping, typeof(Target).GetProperty("Version").ToMember());
SpecificationExtensions.ShouldBeTrue(mapping.Version.Columns.All(x => x.NotNull == true));
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:8,代码来源:VersionStepTests.cs
示例8: ShouldMapInheritedByteArray
public void ShouldMapInheritedByteArray()
{
var mapping = new ClassMapping { Type = typeof(SubTarget) };
mapper.Map(mapping, typeof(SubTarget).GetProperty("Version"));
Assert.That(mapping.Version, Is.Not.Null);
}
开发者ID:playtime,项目名称:fluent-nhibernate,代码行数:8,代码来源:AutoMapVersionTester.cs
示例9: ShouldMapByteArrayAsTimestampSqlType
public void ShouldMapByteArrayAsTimestampSqlType()
{
var mapping = new ClassMapping { Type = typeof(Target) };
mapper.Map(mapping, typeof(Target).GetProperty("Version"));
mapping.Version.Columns.All(x => x.SqlType == "timestamp").ShouldBeTrue();
}
开发者ID:JonKruger,项目名称:fluent-nhibernate,代码行数:8,代码来源:AutoMapVersionTester.cs
示例10: ClassInspector
public ClassInspector(ClassMapping mapping)
{
this.mapping = mapping;
propertyMappings.Map(x => x.LazyLoad, x => x.Lazy);
propertyMappings.Map(x => x.ReadOnly, x => x.Mutable);
propertyMappings.Map(x => x.EntityType, x => x.Type);
}
开发者ID:akhuang,项目名称:NHibernateTest,代码行数:8,代码来源:ClassInspector.cs
示例11: ShouldSetContainingEntityType
public void ShouldSetContainingEntityType()
{
var mapping = new ClassMapping { Type = typeof(Target) };
mapper.Map(mapping, typeof(Target).GetProperty("Version").ToMember());
mapping.Version.ContainingEntityType.ShouldEqual(typeof(Target));
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:8,代码来源:VersionStepTests.cs
示例12: ShouldMapByteArrayAsNotNull
public void ShouldMapByteArrayAsNotNull()
{
var mapping = new ClassMapping { Type = typeof(Target) };
mapper.Map(mapping, typeof(Target).GetProperty("Version"));
mapping.Version.Columns.All(x => x.NotNull == true).ShouldBeTrue();
}
开发者ID:JonKruger,项目名称:fluent-nhibernate,代码行数:8,代码来源:AutoMapVersionTester.cs
示例13: ShouldMapByteArrayWithUnsavedValueOfNull
public void ShouldMapByteArrayWithUnsavedValueOfNull()
{
var mapping = new ClassMapping { Type = typeof(Target) };
mapper.Map(mapping, typeof(Target).GetProperty("Version"));
mapping.Version.UnsavedValue.ShouldEqual(null);
}
开发者ID:JonKruger,项目名称:fluent-nhibernate,代码行数:8,代码来源:AutoMapVersionTester.cs
示例14: ShouldWriteBag
public void ShouldWriteBag()
{
var mapping = new ClassMapping();
mapping.AddCollection(new BagMapping());
writer.VerifyXml(mapping)
.Element("bag").Exists();
}
开发者ID:JasonTrue,项目名称:fluent-nhibernate,代码行数:9,代码来源:XmlClassWriterTester.cs
示例15: ShouldWriteAny
public void ShouldWriteAny()
{
var mapping = new ClassMapping();
mapping.AddAny(new AnyMapping());
writer.VerifyXml(mapping)
.Element("any").Exists();
}
开发者ID:JasonTrue,项目名称:fluent-nhibernate,代码行数:9,代码来源:XmlClassWriterTester.cs
示例16: ShouldSetContainingEntityType
public void ShouldSetContainingEntityType()
{
var mapping = new ClassMapping();
mapping.Set(x => x.Type, Layer.Defaults, typeof(Target));
mapper.Map(mapping, typeof(Target).GetProperty("Version").ToMember());
mapping.Version.ContainingEntityType.ShouldEqual(typeof(Target));
}
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:9,代码来源:VersionStepTests.cs
示例17: ShouldMapInheritedByteArray
public void ShouldMapInheritedByteArray()
{
var mapping = new ClassMapping();
mapping.Set(x => x.Type, Layer.Defaults, typeof(SubTarget));
mapper.Map(mapping, typeof(SubTarget).GetProperty("Version").ToMember());
Assert.That(mapping.Version, Is.Not.Null);
}
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:9,代码来源:VersionStepTests.cs
示例18: ShouldMapByteArrayWithUnsavedValueOfNull
public void ShouldMapByteArrayWithUnsavedValueOfNull()
{
var mapping = new ClassMapping();
mapping.Set(x => x.Type, Layer.Defaults, typeof(Target));
mapper.Map(mapping, typeof(Target).GetProperty("Version").ToMember());
mapping.Version.UnsavedValue.ShouldEqual(null);
}
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:9,代码来源:VersionStepTests.cs
示例19: ShouldMapByteArrayAsNotNull
public void ShouldMapByteArrayAsNotNull()
{
var mapping = new ClassMapping();
mapping.Set(x => x.Type, Layer.Defaults, typeof(Target));
mapper.Map(mapping, typeof(Target).GetProperty("Version").ToMember());
mapping.Version.Columns.All(x => x.NotNull).ShouldBeTrue();
}
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:9,代码来源:VersionStepTests.cs
示例20: ShouldMapByteArrayAsBinaryBlob
public void ShouldMapByteArrayAsBinaryBlob()
{
var mapping = new ClassMapping();
mapping.Set(x => x.Type, Layer.Defaults, typeof(Target));
mapper.Map(mapping, typeof(Target).GetProperty("Version").ToMember());
mapping.Version.Type.ShouldEqual(new TypeReference("BinaryBlob"));
}
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:9,代码来源:VersionStepTests.cs
注:本文中的ClassMapping类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论