本文整理汇总了C#中Mappings类的典型用法代码示例。如果您正苦于以下问题:C# Mappings类的具体用法?C# Mappings怎么用?C# Mappings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Mappings类属于命名空间,在下文中一共展示了Mappings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MappingRootBinder
public MappingRootBinder(Mappings mappings, XmlNamespaceManager namespaceManager,
Dialect.Dialect dialect)
: base(mappings)
{
this.namespaceManager = namespaceManager;
this.dialect = dialect;
}
开发者ID:zibler,项目名称:zibler,代码行数:7,代码来源:MappingRootBinder.cs
示例2: CreateCustomObject
private static IAuxiliaryDatabaseObject CreateCustomObject(Mappings mappings, HbmDatabaseObject databaseObjectSchema)
{
HbmDefinition definitionSchema = databaseObjectSchema.FindDefinition();
string customTypeName = [email protected];
try
{
string className =
TypeNameParser.Parse(customTypeName, mappings.DefaultNamespace, mappings.DefaultAssembly).ToString();
System.Type customType = ReflectHelper.ClassForName(className);
IAuxiliaryDatabaseObject customObject = (IAuxiliaryDatabaseObject)Activator.CreateInstance(customType);
Dictionary<string, string> parameters = definitionSchema.FindParameters();
customObject.SetParameterValues(parameters);
foreach (string dialectName in databaseObjectSchema.FindDialectScopeNames())
{
customObject.AddDialectScope(dialectName);
}
return customObject;
}
catch (TypeLoadException exception)
{
throw new MappingException(string.Format("Could not locate custom database object class [{0}].", customTypeName),
exception);
}
catch (Exception exception)
{
throw new MappingException(
string.Format("Could not instantiate custom database object class [{0}].", customTypeName), exception);
}
}
开发者ID:zibler,项目名称:zibler,代码行数:33,代码来源:AuxiliaryDatabaseObjectFactory.cs
示例3: Binder
protected Binder(Mappings mappings)
{
if (mappings == null)
throw new ArgumentNullException("mappings");
this.mappings = mappings;
}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:7,代码来源:Binder.cs
示例4: FullClassName
/// <summary>
/// Converts a partial class name into a fully one
/// </summary>
/// <param name="className"></param>
/// <param name="mappings"></param>
/// <returns>The class FullName (without the assembly)</returns>
/// <remarks>
/// The FullName is equivalent to the default entity-name
/// </remarks>
protected static string FullClassName(string className, Mappings mappings)
{
if (className == null)
return null;
return TypeNameParser.Parse(className, mappings.DefaultNamespace, mappings.DefaultAssembly).Type;
}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:16,代码来源:Binder.cs
示例5: TypeBinder
public TypeBinder(SimpleValue value, Mappings mappings)
: base(mappings)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
this.value = value;
}
开发者ID:hoangduc007,项目名称:nhibernate-core,代码行数:9,代码来源:TypeBinder.cs
示例6: PropertiesBinder
public PropertiesBinder(Mappings mappings, Component component, string className, string path, bool isNullable, Dialect.Dialect dialect)
: base(mappings, dialect)
{
persistentClass = component.Owner;
this.component = component;
entityName = className;
this.className = component.ComponentClassName;
mappedClass = component.ComponentClass;
propertyBasePath = path;
componetDefaultNullable = isNullable;
}
开发者ID:pruiz,项目名称:nhibernate-old,代码行数:11,代码来源:PropertiesBinder.cs
示例7: Scan
public static FluentConfig Scan(Action<IConventionScanner> scanner)
{
var scannerSettings = ProcessSettings(scanner);
if (scannerSettings.Lazy)
{
var lazyPocoMappings = new Mappings();
return SetFactory(lazyPocoMappings, scanner);
}
return Configure(CreateMappings(scannerSettings, null));
}
开发者ID:rplaner,项目名称:NPoco,代码行数:11,代码来源:FluentMappingConfiguration.cs
示例8: Scan
public static Mappings Scan(Action<IConventionScanner> scanner)
{
var scannerSettings = ProcessSettings(scanner);
if (scannerSettings.Lazy)
{
var lazyPocoMappings = new Mappings();
SetFactory(lazyPocoMappings, scanner);
return lazyPocoMappings;
}
return CreateMappings(scannerSettings, null);
}
开发者ID:NickJosevski,项目名称:NPoco,代码行数:12,代码来源:FluentMappingConfiguration.cs
示例9: PostgresBulkInserter
public PostgresBulkInserter(string nameOrConnectionString, Type type, Mappings columnMappings = null)
{
_type = type;
try
{
_connectionString = ConfigUtilities.GetConnectionString(nameOrConnectionString);
}
catch (ConfigurationErrorsException configException)
{
_connectionString = nameOrConnectionString;
}
ColumnMappings = columnMappings ?? new Mappings(type).MapDirectly();
}
开发者ID:KyleGobel,项目名称:Chronos,代码行数:13,代码来源:PostgresBulkInserter.cs
示例10: GetMappings
public void GetMappings()
{
string folder = @"../../Framework/TestData/Mappings";
Mappings mapping = new Mappings(folder);
Assert.IsNotNull(mapping);
Assert.AreEqual(8, mapping.Count);
IList specials = GetSpecialMaps(mapping.Keys);
Assert.AreEqual(1, specials.Count);
Assert.IsNotNull(mapping["java.lang.StringBuffer"]);
IDictionary ressField = mapping["java.lang.StringBuffer"].Members;
Assert.AreEqual(4, ressField.Count);
}
开发者ID:sourcewarehouse,项目名称:janett,代码行数:16,代码来源:MappingsTest.cs
示例11: CanBulkInsertIntoPostgres
public void CanBulkInsertIntoPostgres()
{
var mappings = new Mappings<Db>().MapAsLowercaseUnderscore();
Chronos.PostgreSQL.PostgresBulkInserter<Db> bcp = new Chronos.PostgreSQL.PostgresBulkInserter<Db>("Server=127.0.0.1;Port=5432;Database=jinx;User Id=postgres;Password=postgres", mappings);
var itemsToInsert = new List<Db>
{
new Db {DatabaseId = Guid.NewGuid(), Name = "Random1"},
new Db {DatabaseId = Guid.NewGuid(), Name = "Random2"},
new Db {DatabaseId = Guid.NewGuid(), Name = "Random4"},
new Db {DatabaseId = Guid.NewGuid(), Name = "Random3"},
new Db {DatabaseId = Guid.NewGuid(), Name = "Random5"},
new Db {DatabaseId = Guid.NewGuid(), Name = "Random6"},
new Db {DatabaseId = Guid.NewGuid(), Name = "Random7"},
};
bcp.Insert(itemsToInsert, "databases");
}
开发者ID:KyleGobel,项目名称:Chronos,代码行数:17,代码来源:BulkInsertTestsPostgres.cs
示例12: CanBulkInsertToPostgresNonGenericly
public void CanBulkInsertToPostgresNonGenericly()
{
var mappings = new Mappings(typeof(Db)).MapAsLowercaseUnderscore();
var bcp = new Chronos.PostgreSQL.PostgresBulkInserter("Server=127.0.0.1;Port=5432;Database=jinx;User Id=postgres;Password=postgres", typeof(Db),mappings);
var itemsToInsert = new List<Db>
{
new Db {DatabaseId = Guid.NewGuid(), Name = "NonGeneric"},
new Db {DatabaseId = Guid.NewGuid(), Name = "RNonGenericandom2"},
new Db {DatabaseId = Guid.NewGuid(), Name = "RNonGenericandom4"},
new Db {DatabaseId = Guid.NewGuid(), Name = "RNonGenericandom3"},
new Db {DatabaseId = Guid.NewGuid(), Name = "NonGenericRandom5"},
new Db {DatabaseId = Guid.NewGuid(), Name = "RNonGenericandom6"},
new Db {DatabaseId = Guid.NewGuid(), Name = "RNonGenericandom7"},
};
bcp.Insert(itemsToInsert, "databases");
}
开发者ID:KyleGobel,项目名称:Chronos,代码行数:17,代码来源:BulkInsertTestsPostgres.cs
示例13: CreateMappings
private static Mappings CreateMappings(ConventionScannerSettings scannerSettings, Type[] typesOverride)
{
var types = typesOverride ?? FindTypes(scannerSettings);
var config = new Dictionary<Type, TypeDefinition>();
foreach (var type in types)
{
var pocoDefn = new TypeDefinition(type)
{
AutoIncrement = scannerSettings.PrimaryKeysAutoIncremented(type),
PrimaryKey = scannerSettings.PrimaryKeysNamed(type),
TableName = scannerSettings.TablesNamed(type),
SequenceName = scannerSettings.SequencesNamed(type),
ExplicitColumns = true
};
foreach (var prop in ReflectionUtils.GetFieldsAndPropertiesForClasses(type))
{
var column = new ColumnDefinition();
column.MemberInfo = prop;
column.DbColumnName = scannerSettings.PropertiesNamed(prop);
column.DbColumnAlias = scannerSettings.AliasNamed(prop);
column.IgnoreColumn = scannerSettings.IgnorePropertiesWhere.Any(x => x.Invoke(prop));
column.DbColumnType = scannerSettings.DbColumnTypesAs(prop);
column.ResultColumn = scannerSettings.ResultPropertiesWhere(prop);
column.ComputedColumn = scannerSettings.ComputedPropertiesWhere(prop);
column.VersionColumn = scannerSettings.VersionPropertiesWhere(prop);
column.ForceUtc = scannerSettings.ForceDateTimesToUtcWhere(prop);
pocoDefn.ColumnConfiguration.Add(prop.Name, column);
}
config.Add(type, pocoDefn);
}
MergeOverrides(config, scannerSettings.MappingOverrides);
//if (scannerSettings.OverrideWithAttributes)
//{
// MergeAttributeOverrides(config);
//}
var pocoMappings = new Mappings {Config = config};
return pocoMappings;
}
开发者ID:tu226,项目名称:Eagle,代码行数:44,代码来源:FluentMappingConfiguration.cs
示例14: Diff
public override DifferenceType Diff(IDifferences differences, Mappings.MemberMapping mapping)
{
ITypeDefinitionMember impl = mapping[0];
ITypeDefinitionMember contract = mapping[1];
if (impl == null)
return DifferenceType.Unknown;
if (contract == null && impl.IsAbstract())
{
// If the type is effectively sealed then it is ok to remove abstract members
ITypeDefinition contractType = mapping.ContainingType[1];
// We check that interfaces have the same number of members in another rule so there is no need to check that here.
if (contractType != null && (contractType.IsEffectivelySealed() || (contractType.IsInterface && mapping.ContainingType[0].IsInterface)))
return DifferenceType.Unknown;
differences.AddIncompatibleDifference(this,
"Member '{0}' is abstract in the implementation but is missing in the contract.",
impl.FullName());
return DifferenceType.Changed;
}
return DifferenceType.Unknown;
}
开发者ID:dsgouda,项目名称:buildtools,代码行数:23,代码来源:CannotAddAbstractMembers.cs
示例15: CreateMappings
private static Mappings CreateMappings(ConventionScannerSettings scannerSettings, Type[] typesOverride)
{
var types = typesOverride ?? FindTypes(scannerSettings);
var config = new Dictionary<Type, TypeDefinition>();
foreach (var type in types)
{
var pocoDefn = new TypeDefinition(type)
{
AutoIncrement = scannerSettings.PrimaryKeysAutoIncremented(type),
PrimaryKey = scannerSettings.PrimaryKeysNamed(type),
TableName = scannerSettings.TablesNamed(type),
SequenceName = scannerSettings.SequencesNamed(type),
};
foreach (var prop in type.GetProperties())
{
var column = new ColumnDefinition();
column.PropertyInfo = prop;
column.DbColumnName = scannerSettings.PropertiesNamed(prop);
column.IgnoreColumn = scannerSettings.IgnorePropertiesWhere.Any(x => x.Invoke(prop));
column.ResultColumn = scannerSettings.ResultPropertiesWhere(prop);
column.VersionColumn = scannerSettings.VersionPropertiesWhere(prop);
pocoDefn.ColumnConfiguration.Add(prop.Name, column);
}
config.Add(type, pocoDefn);
}
MergeOverrides(config, scannerSettings.MappingOverrides);
var pocoMappings = new Mappings {Config = config};
SetFactory(pocoMappings, null);
return pocoMappings;
}
开发者ID:NickJosevski,项目名称:NPoco,代码行数:36,代码来源:FluentMappingConfiguration.cs
示例16: GetQualifiedClassName
protected static string GetQualifiedClassName(string unqualifiedName, Mappings mappings)
{
return ClassForNameChecked(unqualifiedName, mappings, "unknown class {0}").AssemblyQualifiedName;
}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:4,代码来源:Binder.cs
示例17: GetClassName
protected static string GetClassName(string unqualifiedName, Mappings mappings)
{
return ClassForNameChecked(unqualifiedName, mappings, "unknown class {0}").FullName;
//return TypeNameParser.Parse(unqualifiedName, mappings.DefaultNamespace, mappings.DefaultAssembly).ToString();
}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:5,代码来源:Binder.cs
示例18: ClassForNameChecked
/// <summary>
/// Similar to <see cref="ClassForFullNameChecked" />, but handles short class names
/// by calling <see cref="FullQualifiedClassName" />.
/// </summary>
/// <param name="name"></param>
/// <param name="mappings"></param>
/// <param name="errorMessage"></param>
/// <returns></returns>
protected static System.Type ClassForNameChecked(string name, Mappings mappings, string errorMessage)
{
return ClassForFullNameChecked(FullQualifiedClassName(name, mappings), errorMessage);
}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:12,代码来源:Binder.cs
示例19: IdGeneratorBinder
public IdGeneratorBinder(Mappings mappings) : base(mappings) {}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:1,代码来源:IdGeneratorBinder.cs
示例20: UnionSubclassBinder
public UnionSubclassBinder(Mappings mappings, Dialect.Dialect dialect)
: base(mappings, dialect)
{
}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:4,代码来源:UnionSubclassBinder.cs
注:本文中的Mappings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论