本文整理汇总了C#中IPropertyMap类的典型用法代码示例。如果您正苦于以下问题:C# IPropertyMap类的具体用法?C# IPropertyMap怎么用?C# IPropertyMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPropertyMap类属于命名空间,在下文中一共展示了IPropertyMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetParameterName
protected override string GetParameterName(IPropertyMap propertyMap, string prefix)
{
string name = prefix;
name = name + propertyMap.Name;
name = ":" + name + GetNextParamNr().ToString() ;
return name;
}
示例2: NotifyPropertyLoad
public virtual void NotifyPropertyLoad(object obj, IPropertyMap propertyMap, object value)
{
if (propertyMap.NoInverseManagement)
return;
if (propertyMap.ReferenceType == ReferenceType.None)
return;
if (!(propertyMap.Inverse.Length > 0))
return;
IPropertyMap invPropertyMap = propertyMap.MustGetInversePropertyMap();
if (invPropertyMap == null)
return;
if (propertyMap.ReferenceType == ReferenceType.ManyToMany)
{
HandleManyManyPropertyLoad(obj, propertyMap, invPropertyMap, (IList) value);
}
if (propertyMap.ReferenceType == ReferenceType.ManyToOne)
{
HandleManyOnePropertyLoad(obj, propertyMap, invPropertyMap, (IList) value);
}
if (propertyMap.ReferenceType == ReferenceType.OneToMany)
{
HandleOneManyPropertyLoad(obj, propertyMap, invPropertyMap, value);
}
if (propertyMap.ReferenceType == ReferenceType.OneToOne)
{
HandleOneOnePropertyLoad(obj, propertyMap, invPropertyMap, value);
}
}
示例3: CloneList
public virtual IList CloneList(object obj, IPropertyMap propertyMap, IList orgList)
{
Type t = obj.GetType() ;
Type listType = t.GetProperty(propertyMap.Name).PropertyType;
IList newList = Context.ProxyFactory.CreateListProxy(listType,Context.ObjectFactory,new object[0] ) ;
IInterceptableList mList;
bool stackMute = false;
mList = newList as IInterceptableList;
if (mList != null)
{
stackMute = mList.MuteNotify;
mList.MuteNotify = true;
mList.Interceptable = (IInterceptable) obj;
mList.PropertyName = propertyMap.Name;
}
foreach (object item in orgList)
{
newList.Add(item);
}
if (mList != null)
{
mList.MuteNotify = stackMute;
}
return newList;
}
示例4: GetPropertyColumn
public virtual SqlColumnAlias GetPropertyColumn(IPropertyMap propertyMap, object hash)
{
if (hash == null) { hash = propertyMap; }
SqlTableAlias tbl = sqlEmitter.GetTableAlias(propertyMap.MustGetTableMap(), hash) ;
IColumnMap columnMap = propertyMap.GetColumnMap();
return tbl.GetSqlColumnAlias(columnMap);
}
示例5: ChangeOperator
public void ChangeOperator(Func<IDbConnection, IDbTransaction,object, object> action, IDbContext context, dynamic entity,IPropertyMap map=null)
{
OperatorInfo item = new OperatorInfo {
func = action,
Context = context,
entity = entity,
Map = map
};
this.list.Add(item);
}
示例6: SqlEmitter
public SqlEmitter(INPathEngine npathEngine, NPathSelectQuery query,NPathQueryType queryType, IClassMap rootClassMap,SqlSelectStatement parentQuery,IPropertyMap backReference,int subQueryLevel)
{
this.npathEngine = npathEngine;
this.query = query;
this.rootClassMap = rootClassMap;
propertyPathTraverser = new PropertyPathTraverser(this);
this.propertyColumnMap = new Hashtable() ;
this.npathQueryType = queryType;
this.parentQuery = parentQuery;
this.backReference = backReference;
this.subQueryLevel = subQueryLevel;
}
示例7: GenerateDLinqField
public static void GenerateDLinqField(IClassMap classMap, IPropertyMap propertyMap, CodeTypeDeclaration classDecl)
{
switch (propertyMap.ReferenceType)
{
case ReferenceType.None :
classDecl.Members.Add(GenerateDLinqPrimitiveField(classMap, propertyMap));
break;
case ReferenceType.OneToMany :
GenerateDLinqOneToManyFields(classMap, propertyMap, classDecl);
break;
}
}
示例8: ObjectTreeNode
public ObjectTreeNode(IContext context, object obj, object referencedByObj, IPropertyMap referencedByPropertyMap)
{
this.context = context;
this.obj = obj;
this.ClassMap = context.DomainMap.MustGetClassMap(obj.GetType() );
this.referencedByObj = referencedByObj;
this.referencedByClassMap = context.DomainMap.MustGetClassMap(ReferencedByObj.GetType() );
this.referencedByPropertyMap = referencedByPropertyMap;
this.Nodes.Add(new TreeNode() );
SetText();
this.ImageIndex = 0;
this.SelectedImageIndex = 0;
}
示例9: GenerateProperty
/// <summary>
/// Generates the property.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="property">The property.</param>
/// <param name="isReadOnly">if set to <c>true</c> the readonly property is generated.</param>
public static void GenerateProperty(StreamWriter file, IPropertyMap property, bool isReadOnly)
{
string fieldType = ConvertColumnTypeToCsType(property.GetColumnMap().DataType);
string fieldName = GetFieldName(property);
file.WriteLine("\t\tpublic " + fieldType + " " + property.Name);
file.WriteLine("\t\t{");
file.WriteLine("\t\t\tget { return " + fieldName + "; }");
if (!isReadOnly)
{
file.WriteLine("\t\t\tset { " + fieldName + " = value; }");
}
file.WriteLine("\t\t}");
}
示例10: BuildObjectIdentity
private string BuildObjectIdentity(object obj, IPropertyMap newPropertyMap, object newValue)
{
string id = "";
IClassMap classMap = m_ObjectManager.Context.DomainMap.MustGetClassMap(obj.GetType());
string sep = classMap.IdentitySeparator;
// bool gotObjectStatus = false;
// ObjectStatus objStatus = ObjectStatus.Clean;
if (sep == "")
{
sep = "|";
}
object value;
foreach (IPropertyMap propertyMap in classMap.GetIdentityPropertyMaps())
{
if (propertyMap == newPropertyMap)
{
value = newValue;
if (propertyMap.ReferenceType != ReferenceType.None)
{
value = m_ObjectManager.GetObjectIdentity(value);
}
}
else
{
value = m_ObjectManager.GetPropertyValue(obj, propertyMap.Name);
if (value == null || m_ObjectManager.GetNullValueStatus(obj, propertyMap.Name) == true)
{
if (!(m_hashTempIds.ContainsKey(obj)))
{
m_hashTempIds[obj] = Guid.NewGuid().ToString();
}
return (string)m_hashTempIds[obj];
}
else if (propertyMap.ReferenceType != ReferenceType.None)
{
//this ensures that a complete id can be created ahead in case of auto-in
//m_ObjectManager.GetPropertyValue(obj, propertyMap.Name);
value = m_ObjectManager.GetObjectIdentity(value);
}
}
id += Convert.ToString(value) + sep;
}
if (id.Length > sep.Length)
{
id = id.Substring(0, id.Length - sep.Length);
}
return id;
}
示例11: GenerateDLinqOneToManyFields
/*
private System.Nullable<int> _ReportsTo;
private EntityRef<Employee> _ReportsToEmployee;
* */
public static void GenerateDLinqOneToManyFields(IClassMap classMap, IPropertyMap propertyMap, CodeTypeDeclaration classDecl)
{
foreach (IColumnMap columnMap in propertyMap.GetAllColumnMaps())
{
string fieldName = propertyMap.GenerateMemberName(columnMap.Name);
CodeMemberField fieldMember = new CodeMemberField() ;
fieldMember.Name = fieldName;
//Add code for adding Nullable generics when OM is ported to .NET 2.0
CodeTypeReference typeReference = new CodeTypeReference(columnMap.GetSystemType());
fieldMember.Type = typeReference;
classDecl.Members.Add(fieldMember);
}
}
示例12: SetupJoin
public void SetupJoin(IPropertyMap propertyMap, IPropertyMap parentMap, string propertyPath, JoinType joinType)
{
TableJoin tableJoin = GetTableJoinForPropertyPath(propertyPath);
if (tableJoin == null)
{
tableJoin = new TableJoin();
tableJoin.PropertyMap = propertyMap;
tableJoin.JoinType = joinType;
if (parentMap == null)
{
tableJoin.JoinTree = this;
this.propertyPathTraverser.SqlEmitter.GetTableAlias(propertyMap.MustGetTableMap(), propertyMap);
}
else
{
//make sure the table has an alias
tableJoin.Parent = GetTableJoinForPropertyPath(propertyPath.Substring(0, propertyPath.Length - propertyMap.Name.Length - 1));
this.propertyPathTraverser.SqlEmitter.GetTableAlias(propertyMap.MustGetTableMap(), tableJoin.Parent);
}
}
}
示例13: GetValidationMode
public virtual ValidationMode GetValidationMode(IClassMap classMap, IPropertyMap propertyMap)
{
ValidationMode validationMode = propertyMap.ValidationMode;
if (validationMode == ValidationMode.Default)
{
validationMode = classMap.ValidationMode;
if (validationMode == ValidationMode.Default)
{
validationMode = classMap.DomainMap.ValidationMode;
if (validationMode == ValidationMode.Default)
{
validationMode = this.Context.ValidationMode;
if (validationMode == ValidationMode.Default)
{
validationMode = ValidationMode.ValidateLoaded;
}
}
}
}
return validationMode;
}
示例14: ObjectPropertyDescriptor
public ObjectPropertyDescriptor(MemberDescriptor descr, IContext context, IPropertyMap propertyMap, object obj, Attribute[] attrs)
: base(descr, attrs)
{
this.realPropertyDescriptor = (PropertyDescriptor) descr;
this.name = propertyMap.Name;
this.displayName = propertyMap.Name;
Attribute[] attribs = new Attribute[descr.Attributes.Count + 4];
int i = 0;
foreach (Attribute attrib in descr.Attributes)
{
attribs[i] = attrib;
i++;
}
attribs[i] = new DescriptionAttribute(propertyMap.Name + " is a property.");
attribs[i + 1] = new CategoryAttribute("");
attribs[i + 2] = new DefaultValueAttribute(context.ObjectManager.GetOriginalPropertyValue(obj, propertyMap.Name));
attribs[i + 3] = new ReadOnlyAttribute(propertyMap.IsReadOnly);
attributes = new AttributeCollection(attribs);
}
示例15: GetFieldInfo
/// <summary>
/// Fetches a FieldInfo for a specific property in a given type
/// </summary>
/// <param name="propertyMap"></param>
/// <param name="type"></param>
/// <param name="propertyName"></param>
/// <returns></returns>
//[DebuggerStepThrough()]
public static FieldInfo GetFieldInfo(IPropertyMap propertyMap, Type type, string propertyName)
{
Hashtable fieldLookup = FieldLookup(type);
if (fieldLookup != null)
{
if (!fieldLookup.ContainsKey(propertyName))
{
FieldInfo fieldInfo = type.GetField(propertyMap.GetFieldName(), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
if (fieldInfo == null) //field was not found in this type
fieldInfo = GetFieldInfo(propertyMap, type.BaseType, propertyName); //fetch the field from the base class
lock(syncRoot)
{
if (!fieldLookup.ContainsKey(propertyName))
{
fieldLookup.Add(propertyName, fieldInfo); //cache the field info with this type , even if the field was found in a super class
}
}
}
return fieldLookup[propertyName] as FieldInfo;
}
return null;
}