本文整理汇总了C#中IClassMap类的典型用法代码示例。如果您正苦于以下问题:C# IClassMap类的具体用法?C# IClassMap怎么用?C# IClassMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IClassMap类属于命名空间,在下文中一共展示了IClassMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateFindByMethods
/// <summary>
/// Generates all the 'find by' methods of this interface.
/// </summary>
/// <param name="classMap">The class map.</param>
/// <param name="file">The file.</param>
private static void GenerateFindByMethods(IClassMap classMap, StreamWriter file)
{
foreach (KeyValuePair<int, IList<IPropertyMap>> pair in classMap.DOLGetFindByGroups())
{
IList<IPropertyMap> paramProps = pair.Value;
string findBy = StringUtility.CombineObjects(paramProps, MapToStringConverters.PropertyAnd)
.ToString();
// method name
file.Write(" IList<" + EntityGenerator.GetTypeName(classMap) + "> FindBy" + findBy);
// method's params
file.Write("(");
bool first = true;
foreach (IPropertyMap propertyMap in paramProps)
{
if (!first)
{
file.Write(", ");
}
// param type and name
string paramName = ClassUtility.GetParamName(propertyMap);
string paramType = ClassUtility.ConvertColumnTypeToCsType(propertyMap.GetColumnMap().DataType);
file.Write(paramType + " " + paramName);
first = false;
}
file.Write(");");
file.WriteLine();
}
}
示例2: GenerateDai
/// <summary>
/// Generates the DAO interface file.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="classMap">The class map.</param>
private static void GenerateDai(string path, IClassMap classMap)
{
using (StreamWriter file = new StreamWriter(path + GetInterfaceName(classMap) + ".cs", false))
{
ClassUtility.AppendHeader(file);
file.WriteLine("using System.Collections.Generic;");
file.WriteLine("using DOL.Database.DataTransferObjects;");
file.WriteLine();
file.WriteLine("namespace DOL.Database.DataAccessInterfaces");
file.WriteLine("{");
file.WriteLine(" public interface " + GetInterfaceName(classMap) + " : IGenericDao<" + EntityGenerator.GetTypeName(classMap) + ">");
file.WriteLine(" {");
// generate 'find' methods
GenerateFindMethods(classMap, file);
// generate 'find by' methods
GenerateFindByMethods(classMap, file);
// generate 'cout by' methods
GenerateCountByMethods(classMap, file);
file.WriteLine(" }");
file.WriteLine("}");
}
}
示例3: GenerateProperties
/// <summary>
/// Generates the public access properties.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="classMap">The class map.</param>
private static void GenerateProperties(StreamWriter file, IClassMap classMap)
{
foreach (IPropertyMap property in classMap.PropertyMaps)
{
ClassUtility.GenerateProperty(file, property, false);
}
}
示例4: GeneratePrivateFields
/// <summary>
/// Generates the private fields of the entity.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="classMap">The class map.</param>
private static void GeneratePrivateFields(StreamWriter file, IClassMap classMap)
{
foreach (IPropertyMap property in classMap.PropertyMaps)
{
ClassUtility.GenerateField(file, property);
}
}
示例5: GetParameterName
protected override string GetParameterName(IClassMap classMap, string prefix)
{
string name = prefix;
name = name + classMap.Name;
name = ":" + name;
return name;
}
示例6: GetFactoryClassCompileUnit
public static CodeCompileUnit GetFactoryClassCompileUnit(IClassMap classMap)
{
CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
codeCompileUnit.Namespaces.Add(GenerateFactoryClass(classMap));
return codeCompileUnit ;
}
示例7: DocumentClassMapPropertyDescriptor
/// <summary>
/// Initializes a new instance of the <see cref="DocumentClassMapPropertyDescriptor"/> class.
/// </summary>
/// <param name="mappingStore">The mapping store.</param>
/// <param name="classMap">The class map.</param>
/// <param name="document">The document.</param>
public DocumentClassMapPropertyDescriptor(IMappingStore mappingStore, IClassMap classMap, Document document)
: base(mappingStore, classMap)
{
if (document == null)
throw new ArgumentNullException("document");
_document = document;
}
示例8: AliasForTable
public string AliasForTable(IClassMap classMap)
{
if (classMap != null)
foreach (var pair in _classMaps)
if (pair.Value == classMap)
return pair.Key;
return String.Format("t_{0}", _tIndex++);
}
示例9: ExampleClassMapPropertyDescriptor
/// <summary>
/// Initializes a new instance of the <see cref="ExampleClassMapPropertyDescriptor"/> class.
/// </summary>
/// <param name="mappingStore">The mapping store.</param>
/// <param name="classMap">The class map.</param>
/// <param name="example">The example.</param>
public ExampleClassMapPropertyDescriptor(IMappingStore mappingStore, IClassMap classMap, object example)
: base(mappingStore, classMap)
{
if (example == null)
throw new ArgumentNullException("example");
_example = example;
_exampleType = _example.GetType();
}
示例10: SqlEmitter
public SqlEmitter(INPathEngine npathEngine, NPathSelectQuery query,NPathQueryType queryType, IClassMap rootClassMap, Hashtable propertyColumnMap)
{
this.npathEngine = npathEngine;
this.query = query;
this.rootClassMap = rootClassMap;
propertyPathTraverser = new PropertyPathTraverser(this);
this.propertyColumnMap = propertyColumnMap;
this.npathQueryType = queryType;
}
示例11: MustGetTypeFromClassMap
public virtual Type MustGetTypeFromClassMap(IClassMap classMap)
{
Type type = GetTypeFromClassMap(classMap);
if (type == null)
throw new MappingException("Could not find the type for the class " + classMap.Name + " (found in the map file) in any loaded Assembly!");
return type;
}
示例12: ClassMapPropertyDescriptor
/// <summary>
/// Initializes a new instance of the <see cref="ClassMapPropertyDescriptor"/> class.
/// </summary>
/// <param name="mappingStore">The mapping store.</param>
/// <param name="classMap">The class map.</param>
/// <param name="instance">The instance.</param>
public ClassMapPropertyDescriptor(IMappingStore mappingStore, IClassMap classMap, object instance)
: base(mappingStore, classMap)
{
if (instance == null)
throw new ArgumentNullException("instance");
_instance = instance;
if (ClassMap.HasExtendedProperties)
_extendedProperties = (IDictionary<string, object>)ClassMap.ExtendedPropertiesMap.GetValue(instance);
}
示例13: GetRepositoryClassCsharp
public static string GetRepositoryClassCsharp(IClassMap classMap)
{
CodeCompileUnit compileunit = CodeDomGenerator.GetRepositoryClassCompileUnit(classMap);
CodeDomProvider provider = new CSharpCodeProvider();
string code = CodeDomGenerator.ToCode(compileunit, provider);
return code;
}
示例14: GenerateCustomFieldsAndMethods
/// <summary>
/// Generates custom fields and methods of the class.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="classMap">The class map.</param>
public override void GenerateCustomFieldsAndMethods(StreamWriter file, IClassMap classMap)
{
ArrayList allColumns = classMap.GetTableMap().ColumnMaps;
IColumnMap[] allColumnsTyped = (IColumnMap[]) allColumns.ToArray(typeof (IColumnMap));
string columnNames = StringUtility.CombineObjects(allColumnsTyped, MapToStringConverters.Columns).ToString();
file.WriteLine(" protected static readonly string c_rowFields = \"" + columnNames + "\";");
base.GenerateCustomFieldsAndMethods(file, classMap);
}
示例15: ClassMapPropertyDescriptorBase
/// <summary>
/// Initializes a new instance of the <see cref="ClassMapPropertyDescriptorBase"/> class.
/// </summary>
/// <param name="mappingStore">The mapping store.</param>
/// <param name="classMap">The class map.</param>
protected ClassMapPropertyDescriptorBase(IMappingStore mappingStore, IClassMap classMap)
{
if (mappingStore == null)
throw new ArgumentNullException("mappingStore");
if (classMap == null)
throw new ArgumentNullException("classMap");
_mappingStore = mappingStore;
ClassMap = classMap;
_codeReplacer = new JavascriptMemberNameReplacer(_mappingStore);
}