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


C# Puzzle.GetReferencedClassMap方法代码示例

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


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

示例1: GetTableNameForProperty

 public virtual string GetTableNameForProperty(Puzzle.NPersist.Framework.Mapping.IPropertyMap propertyMap)
 {
     string name;
     string clsName;
     IClassMap refClassMap;
     string refClsName;
     if (propertyMap.IsCollection)
     {
         if (!(propertyMap.ReferenceType == ReferenceType.None))
         {
             clsName = propertyMap.ClassMap.GetName();
             refClassMap = propertyMap.GetReferencedClassMap();
             if (!(propertyMap.GetReferencedClassMap() == null))
             {
                 refClsName = refClassMap.GetName();
                 if (clsName.GetHashCode() > refClsName.GetHashCode())
                 {
                     name = TablePrefix + refClsName + "_" + clsName + TableSuffix;
                 }
                 else
                 {
                     name = TablePrefix + clsName + "_" + refClsName + TableSuffix;
                 }
             }
             else
             {
                 throw new Exception("Referenced class does not exists! Can't create table name for property!");
             }
         }
         else
         {
             name = TablePrefix + propertyMap.ClassMap.GetName() + "_" + propertyMap.Name + TableSuffix;
         }
     }
     else
     {
         name = GetTableNameForClass(propertyMap.ClassMap, true);
     }
     if (m_MaxColumnLength > 0)
     {
         if (name.Length > m_MaxColumnLength)
         {
             name = name.Substring(0, m_MaxColumnLength);
         }
     }
     return name;
 }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:47,代码来源:ClassesToTablesTransformer.cs

示例2: GetColumnScaleForProperty

 public virtual int GetColumnScaleForProperty(Puzzle.NPersist.Framework.Mapping.IPropertyMap propertyMap)
 {
     string dataType = "";
     int scale;
     IPropertyMap refProp = null;
     IClassMap refClassMap;
     if (!(propertyMap.ReferenceType == ReferenceType.None))
     {
         refClassMap = propertyMap.GetReferencedClassMap();
         if (!(refClassMap == null))
         {
             foreach (IPropertyMap idProp in propertyMap.GetReferencedClassMap().GetIdentityPropertyMaps())
             {
                 refProp = idProp;
                 break;
             }
             if (!(refProp == null))
             {
                 if (refProp.IsCollection)
                 {
                     dataType = refProp.ItemType;
                 }
                 else
                 {
                     dataType = refProp.DataType;
                 }
             }
             else
             {
                 //throw...
             }
         }
     }
     else
     {
         if (propertyMap.IsCollection)
         {
             dataType = propertyMap.ItemType;
         }
         else
         {
             dataType = propertyMap.DataType;
         }
     }
     string dataTypeTrimmedLow = dataType.ToLower().Trim();
     if (dataTypeTrimmedLow == "string" || dataTypeTrimmedLow == "system.string")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "integer" || dataTypeTrimmedLow == "int32" || dataTypeTrimmedLow == "int" || dataTypeTrimmedLow == "system.int32")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "short" || dataTypeTrimmedLow == "int16" || dataTypeTrimmedLow == "system.int16")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "long" || dataTypeTrimmedLow == "int64" || dataTypeTrimmedLow == "system.int64")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "uint16" || dataTypeTrimmedLow == "system.uint16")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "uint32" || dataTypeTrimmedLow == "system.uint32")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "uint64" || dataTypeTrimmedLow == "system.uint64")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "date" || dataTypeTrimmedLow == "time" || dataTypeTrimmedLow == "datetime" || dataTypeTrimmedLow == "system.datetime")
     {
         scale = 3;
     }
     else if (dataTypeTrimmedLow == "bool" || dataTypeTrimmedLow == "boolean" || dataTypeTrimmedLow == "system.boolean")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "byte" || dataTypeTrimmedLow == "system.byte" || dataTypeTrimmedLow == "char" || dataTypeTrimmedLow == "system.char")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "decimal" || dataTypeTrimmedLow == "system.decimal")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "double" || dataTypeTrimmedLow == "system.double")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "object" || dataTypeTrimmedLow == "system.object")
     {
         scale = 0;
     }
     else if (dataTypeTrimmedLow == "single" || dataTypeTrimmedLow == "system.single")
     {
         scale = 0;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:101,代码来源:ClassesToTablesTransformer.cs

示例3: GetColumnTypeForProperty

 public virtual System.Data.DbType GetColumnTypeForProperty(Puzzle.NPersist.Framework.Mapping.IPropertyMap propertyMap)
 {
     string dataType = "";
     System.Data.DbType columnType;
     IPropertyMap refProp = null;
     IClassMap refClassMap;
     if (!(propertyMap.ReferenceType == ReferenceType.None))
     {
         refClassMap = propertyMap.GetReferencedClassMap();
         if (!(refClassMap == null))
         {
             foreach (IPropertyMap idProp in refClassMap.GetIdentityPropertyMaps())
             {
                 refProp = idProp;
                 break;
             }
             if (refProp != null)
             {
                 if (refProp.IsCollection)
                 {
                     dataType = refProp.ItemType;
                 }
                 else
                 {
                     dataType = refProp.DataType;
                 }
             }
             else
             {
                 //throw...
             }
         }
     }
     else
     {
         if (propertyMap.IsCollection)
         {
             dataType = propertyMap.ItemType;
         }
         else
         {
             dataType = propertyMap.DataType;
         }
     }
     string dataTypeTrimmedLow = dataType.ToLower().Trim();
     if (dataTypeTrimmedLow == "string" || dataTypeTrimmedLow == "system.string")
     {
         columnType = DbType.AnsiString;
     }
     else if (dataTypeTrimmedLow == "guid" || dataTypeTrimmedLow == "system.guid")
     {
         columnType = DbType.Guid;
     }
     else if (dataTypeTrimmedLow == "integer" || dataTypeTrimmedLow == "int32" || dataTypeTrimmedLow == "int" || dataTypeTrimmedLow == "system.int32")
     {
         columnType = DbType.Int32;
     }
     else if (dataTypeTrimmedLow == "int16" || dataTypeTrimmedLow == "system.int16" || dataTypeTrimmedLow == "short")
     {
         columnType = DbType.Int16;
     }
     else if (dataTypeTrimmedLow == "int64" || dataTypeTrimmedLow == "system.int64" || dataTypeTrimmedLow == "long")
     {
         columnType = DbType.Int64;
     }
     else if (dataTypeTrimmedLow == "uint16" || dataTypeTrimmedLow == "system.uint16")
     {
         columnType = DbType.UInt16;
     }
     else if (dataTypeTrimmedLow == "uint32" || dataTypeTrimmedLow == "system.uint32")
     {
         columnType = DbType.UInt32;
     }
     else if (dataTypeTrimmedLow == "uint64" || dataTypeTrimmedLow == "system.uint64")
     {
         columnType = DbType.UInt64;
     }
     else if (dataTypeTrimmedLow == "date" || dataTypeTrimmedLow == "time" || dataTypeTrimmedLow == "datetime" || dataTypeTrimmedLow == "system.datetime")
     {
         columnType = DbType.DateTime;
     }
     else if (dataTypeTrimmedLow == "bool" || dataTypeTrimmedLow == "boolean" || dataTypeTrimmedLow == "system.boolean")
     {
         columnType = DbType.Boolean;
     }
     else if (dataTypeTrimmedLow == "byte" || dataTypeTrimmedLow == "system.byte" || dataTypeTrimmedLow == "char" || dataTypeTrimmedLow == "system.char")
     {
         columnType = DbType.Byte;
     }
     else if (dataTypeTrimmedLow == "decimal" || dataTypeTrimmedLow == "system.decimal")
     {
         columnType = DbType.Decimal;
     }
     else if (dataTypeTrimmedLow == "double" || dataTypeTrimmedLow == "system.double")
     {
         columnType = DbType.Double;
     }
     else if (dataTypeTrimmedLow == "object" || dataTypeTrimmedLow == "system.object")
     {
         columnType = DbType.Object;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:101,代码来源:ClassesToTablesTransformer.cs

示例4: GetColumnNameForProperty

 public virtual string GetColumnNameForProperty(Puzzle.NPersist.Framework.Mapping.IPropertyMap propertyMap)
 {
     string name = "";
     IClassMap refClassMap;
     IClassMap useClassMap;
     if (propertyMap.IsIdentity)
     {
         useClassMap = propertyMap.ClassMap;
         if (useClassMap.IsInHierarchy())
         {
             if (!(useClassMap.InheritanceType == InheritanceType.None))
             {
                 while (!(useClassMap.GetInheritedClassMap() == null))
                 {
                     useClassMap = useClassMap.GetInheritedClassMap();
                 }
             }
         }
         if (propertyMap.Name.ToLower() == "id" || propertyMap.Name.ToLower() == "key")
         {
             name = useClassMap.GetName() + propertyMap.Name;
         }
     }
     if (name == "")
     {
         if (!(propertyMap.ReferenceType == ReferenceType.None))
         {
             refClassMap = propertyMap.GetReferencedClassMap();
             if (!(refClassMap == null))
             {
                 foreach (IPropertyMap idProp in refClassMap.GetIdentityPropertyMaps())
                 {
                     if (idProp.ReferenceType == ReferenceType.None)
                     {
                         if (idProp.Column.Length > 0)
                         {
                             name = propertyMap.Name + "_" + idProp.Column;
                         }
                         else
                         {
                             name = propertyMap.Name + "_" + GetColumnNameForProperty(idProp);
                         }
                     }
                     break;
                 }
             }
         }
     }
     if (name == "")
     {
         name = propertyMap.Name;
     }
     if (m_MaxColumnLength > 0)
     {
         if (name.Length > m_MaxColumnLength)
         {
             name = name.Substring(0, m_MaxColumnLength);
         }
     }
     return name;
 }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:61,代码来源:ClassesToTablesTransformer.cs


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