当前位置: 首页>>代码示例>>C#>>正文


C# IPropertyMap.Clone方法代码示例

本文整理汇总了C#中IPropertyMap.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# IPropertyMap.Clone方法的具体用法?C# IPropertyMap.Clone怎么用?C# IPropertyMap.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPropertyMap的用法示例。


在下文中一共展示了IPropertyMap.Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateTableForProperty

 protected virtual void CreateTableForProperty(IPropertyMap propertyMap, IDomainMap targetDomainMap, bool generateMappings)
 {
     IClassMap classMap = propertyMap.ClassMap;
     ITableMap tableMap = null;
     ISourceMap sourceMap = null;
     ISourceMap addToSourceMap = null;
     IClassMap classMapClone = null;
     IPropertyMap propertyMapClone = null;
     string name = "";
     sourceMap = classMap.GetSourceMap();
     if (sourceMap == null)
     {
         sourceMap = classMap.DomainMap.GetSourceMap();
         if (sourceMap == null)
         {
             throw new Exception("No default data source specified for domain model! Can't add table for class!");
         }
     }
     addToSourceMap = targetDomainMap.GetSourceMap(sourceMap.Name);
     if (addToSourceMap == null)
     {
         addToSourceMap = (ISourceMap) sourceMap.Clone();
         addToSourceMap.DomainMap = targetDomainMap;
     }
     if (propertyMap.Table.Length > 0)
     {
         name = propertyMap.Table;
     }
     else
     {
         name = GetTableNameForProperty(propertyMap);
     }
     tableMap = addToSourceMap.GetTableMap(name);
     if (tableMap == null)
     {
         tableMap = new TableMap();
         tableMap.Name = name;
         tableMap.SourceMap = addToSourceMap;
     }
     if (generateMappings & propertyMap.Table.Length < 1)
     {
         classMapClone = targetDomainMap.GetClassMap(classMap.Name);
         if (classMapClone == null)
         {
             classMapClone = (IClassMap) classMap.Clone();
             classMapClone.Table = tableMap.Name;
             if (!(addToSourceMap.Name == targetDomainMap.Source))
             {
                 classMapClone.Source = addToSourceMap.Name;
             }
             classMapClone.DomainMap = targetDomainMap;
         }
         propertyMapClone = classMapClone.GetPropertyMap(propertyMap.Name);
         if (propertyMapClone == null)
         {
             propertyMapClone = (IPropertyMap) propertyMap.Clone();
             propertyMapClone.ClassMap = classMapClone;
         }
         propertyMapClone.Table = tableMap.Name;
         if (!(addToSourceMap.Name == classMapClone.Source))
         {
             if (!(addToSourceMap.Name == targetDomainMap.Source))
             {
                 propertyMapClone.Source = addToSourceMap.Name;
             }
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:68,代码来源:ClassesToTablesTransformer.cs

示例2: CreateColumnForProperty

 protected virtual void CreateColumnForProperty(IPropertyMap propertyMap, IDomainMap targetDomainMap, bool generateMappings, IClassMap ownerClassMap)
 {
     IClassMap classMap = propertyMap.ClassMap;
     ITableMap tableMap = null;
     ISourceMap sourceMap = null;
     ISourceMap addToSourceMap = null;
     IClassMap classMapClone = null;
     IPropertyMap propertyMapClone = null;
     IColumnMap columnMap = null;
     string classTableName = "";
     string name = "";
     string tableName = "";
     bool allowNulls = false;
     IClassMap refClassMap = null;
     string forTableName = "";
     string forColumnName = "";
     int cnt = 0;
     bool found = false;
     string primColName = "";
     string ownerClassTableName = "";
     string foreignKeyName = "";
     sourceMap = classMap.GetSourceMap();
     if (sourceMap == null)
     {
         sourceMap = classMap.DomainMap.GetSourceMap();
         if (sourceMap == null)
         {
             throw new Exception("No default data source specified for domain model! Can't add table for class!");
         }
     }
     addToSourceMap = targetDomainMap.GetSourceMap(sourceMap.Name);
     if (addToSourceMap == null)
     {
         addToSourceMap = (ISourceMap) sourceMap.Clone();
         addToSourceMap.DomainMap = targetDomainMap;
     }
     if (propertyMap.ClassMap.Table.Length > 0)
     {
         classTableName = propertyMap.ClassMap.Table;
     }
     else
     {
         classTableName = GetTableNameForClass(propertyMap.ClassMap);
     }
     if (propertyMap.Table.Length > 0)
     {
         tableName = propertyMap.Table;
     }
     else if (propertyMap.IsCollection)
     {
         tableName = GetTableNameForProperty(propertyMap);
     }
     else
     {
         if (IsOutbrokenByInheritance(propertyMap, ownerClassMap))
         {
             ownerClassTableName = GetTableNameForClass(ownerClassMap, true);
             tableName = ownerClassTableName;
         }
         else
         {
             tableName = classTableName;
         }
     }
     tableMap = addToSourceMap.GetTableMap(tableName);
     if (tableMap == null)
     {
         tableMap = new TableMap();
         tableMap.Name = tableName;
         tableMap.SourceMap = addToSourceMap;
     }
     if (propertyMap.Column.Length > 0)
     {
         name = propertyMap.Column;
     }
     else
     {
         name = GetColumnNameForProperty(propertyMap);
     }
     columnMap = tableMap.GetColumnMap(name);
     if (columnMap == null)
     {
         columnMap = new ColumnMap();
         columnMap.Name = name;
         columnMap.TableMap = tableMap;
     }
     columnMap.DataType = GetColumnTypeForProperty(propertyMap);
     columnMap.Length = GetColumnLengthForProperty(propertyMap);
     columnMap.Precision = GetColumnPrecisionForProperty(propertyMap);
     columnMap.Scale = GetColumnScaleForProperty(propertyMap);
     allowNulls = propertyMap.IsNullable;
     if (propertyMap.IsIdentity)
     {
         allowNulls = false;
     }
     columnMap.AllowNulls = allowNulls;
     if (propertyMap.IsIdentity)
     {
         columnMap.IsPrimaryKey = true;
         columnMap.AllowNulls = false;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:101,代码来源:ClassesToTablesTransformer.cs

示例3: CreateIDColumnForProperty

 protected virtual void CreateIDColumnForProperty(IPropertyMap propertyMap, IDomainMap targetDomainMap, bool generateMappings, IClassMap ownerClassMap)
 {
     IClassMap classMap = propertyMap.ClassMap;
     ITableMap tableMap = null;
     ISourceMap sourceMap = null;
     ISourceMap addToSourceMap = null;
     IClassMap classMapClone = null;
     IPropertyMap propertyMapClone = null;
     IColumnMap columnMap = null;
     string classTableName = "";
     string ownerClassTableName = "";
     string name = "";
     string forColName = "";
     string tableName = "";
     string foreignKeyName = "";
     bool isClassTableOrConcrete = false;
     sourceMap = classMap.GetSourceMap();
     if (sourceMap == null)
     {
         sourceMap = classMap.DomainMap.GetSourceMap();
         if (sourceMap == null)
         {
             throw new Exception("No default data source specified for domain model! Can't add table for class!");
         }
     }
     addToSourceMap = targetDomainMap.GetSourceMap(sourceMap.Name);
     if (addToSourceMap == null)
     {
         addToSourceMap = (ISourceMap) sourceMap.Clone();
         addToSourceMap.DomainMap = targetDomainMap;
     }
     if (propertyMap.ClassMap.Table.Length > 0)
     {
         classTableName = propertyMap.ClassMap.Table;
     }
     else
     {
         classTableName = GetTableNameForClass(propertyMap.ClassMap);
     }
     if (propertyMap.Table.Length > 0)
     {
         tableName = propertyMap.Table;
     }
     else if (propertyMap.IsCollection)
     {
         tableName = GetTableNameForProperty(propertyMap);
     }
     else
     {
         if (IsOutbrokenByInheritance(propertyMap, ownerClassMap))
         {
             isClassTableOrConcrete = true;
             ownerClassTableName = GetTableNameForClass(ownerClassMap, true);
             tableName = ownerClassTableName;
         }
         else
         {
             tableName = classTableName;
         }
     }
     tableMap = addToSourceMap.GetTableMap(tableName);
     if (tableMap == null)
     {
         tableMap = new TableMap();
         tableMap.Name = tableName;
         tableMap.SourceMap = addToSourceMap;
     }
     foreignKeyName = "FK_" + tableMap.Name;
     foreach (IPropertyMap idPropertyMap in propertyMap.ClassMap.GetIdentityPropertyMaps())
     {
         if (idPropertyMap.Column.Length > 0)
         {
             forColName = idPropertyMap.Column;
         }
         else
         {
             forColName = GetColumnNameForProperty(idPropertyMap);
         }
         foreignKeyName += "_" + forColName;
     }
     if (!(classMap.InheritanceType == InheritanceType.None))
     {
         if (classMap.TypeColumn.Length > 0)
         {
             foreignKeyName += "_" + classMap.TypeColumn;
         }
         else
         {
             foreignKeyName += "_" + GetTypeColumnNameForClass(classMap);
         }
     }
     foreach (IPropertyMap idPropertyMap in propertyMap.ClassMap.GetIdentityPropertyMaps())
     {
         if (idPropertyMap.Column.Length > 0)
         {
             forColName = idPropertyMap.Column;
         }
         else
         {
             forColName = GetColumnNameForProperty(idPropertyMap);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:101,代码来源:ClassesToTablesTransformer.cs


注:本文中的IPropertyMap.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。