本文整理汇总了C#中IPropertyMap类的典型用法代码示例。如果您正苦于以下问题:C# IPropertyMap类的具体用法?C# IPropertyMap怎么用?C# IPropertyMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPropertyMap类属于命名空间,在下文中一共展示了IPropertyMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetParameterName
protected override string GetParameterName(IPropertyMap propertyMap, string prefix)
{
string name = prefix;
name = name + propertyMap.Name;
name = ":" + name + GetNextParamNr().ToString() ;
return name;
}
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:7,代码来源:SqlEngineOracle.cs
示例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);
}
}
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:29,代码来源:InverseManager.cs
示例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;
}
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:28,代码来源:ListManager.cs
示例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);
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:9,代码来源:PropertyPathTraverser.cs
示例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);
}
开发者ID:yan122725529,项目名称:SqlComPare_Mvvm,代码行数:10,代码来源:UnitOfWork.cs
示例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;
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:12,代码来源:SqlEmitter.cs
示例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;
}
}
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:12,代码来源:CodeDomGenerator.cs
示例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;
}
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:13,代码来源:ObjectTreeNode.cs
示例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}");
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:20,代码来源:ClassUtility.cs
示例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;
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:49,代码来源:ObjectManagerHelperPOCO.cs
示例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);
}
}
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:24,代码来源:CodeDomGenerator.cs
示例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);
}
}
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:21,代码来源:JoinTree.cs
示例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;
}
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:21,代码来源:ObjectValidator.cs
示例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);
}
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:22,代码来源:ObjectPropertyDescriptor.cs
示例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;
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:32,代码来源:ReflectionHelper.cs
示例16: KeepExistingValue
private bool KeepExistingValue(object value, object extValue, MergeBehaviorType mergeBehavior, IClassMap classMap, IPropertyMap propertyMap, object existing, object obj, PropertyStatus propStatus, PropertyStatus extPropStatus, bool forOrgValue)
{
bool keepExisting = false;
MergeBehaviorType useMergeBehavior = GetMergeBehavior(mergeBehavior, classMap, propertyMap);
if (useMergeBehavior == MergeBehaviorType.ThrowConcurrencyException)
throw new MergeException("Merge Conflict!", extValue, value, existing, obj, propertyMap.Name, forOrgValue);
//First try: Dirty wins..
if (propStatus == PropertyStatus.Dirty && extPropStatus == PropertyStatus.Dirty)
{
if (useMergeBehavior == MergeBehaviorType.DefaultBehavior)
throw new BothDirtyMergeException("Unresovable Merge Conflict! Both values are dirty!", extValue, value, existing, obj, propertyMap.Name, forOrgValue);
else if (useMergeBehavior == MergeBehaviorType.IgnoreConflictsUsingMergeValue)
keepExisting = false;
else if (useMergeBehavior == MergeBehaviorType.IgnoreConflictsUsingCashedValue)
keepExisting = true;
else
throw new NPersistException("This should be unreachable code...if it is not, that means I made a mistake!" );
}
else if (propStatus == PropertyStatus.Dirty)
keepExisting = false;
else if (extPropStatus == PropertyStatus.Dirty)
keepExisting = true;
else
{
//Second try: Clean wins
if (propStatus == PropertyStatus.Clean && extPropStatus == PropertyStatus.Clean)
{
if (useMergeBehavior == MergeBehaviorType.DefaultBehavior)
throw new BothCleanMergeException("Unresovable Merge Conflict! Both values are clean!", extValue, value, existing, obj, propertyMap.Name, forOrgValue);
else if (useMergeBehavior == MergeBehaviorType.IgnoreConflictsUsingMergeValue)
keepExisting = false;
else if (useMergeBehavior == MergeBehaviorType.IgnoreConflictsUsingCashedValue)
keepExisting = true;
else
throw new NPersistException("This should be unreachable code...if it is not, that means I made a mistake!" );
}
else if (propStatus == PropertyStatus.Clean)
keepExisting = false;
else if (extPropStatus == PropertyStatus.Clean)
keepExisting = true;
else
{
if (extPropStatus == PropertyStatus.NotLoaded)
keepExisting = false;
if (extPropStatus == PropertyStatus.Deleted)
keepExisting = true;
else
throw new NPersistException("This should be unreachable code...if it is not, that means I made a mistake!" );
}
}
return keepExisting;
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:53,代码来源:PersistenceManager.cs
示例17: MergePrimitivePropertyValues
private void MergePrimitivePropertyValues(object value, object extValue, PropertyStatus propStatus, PropertyStatus extPropStatus, IObjectManager om, object existing, IClassMap classMap, IPropertyMap propertyMap, object obj, bool forOrgValue, MergeBehaviorType mergeBehavior)
{
if (!value.Equals(extValue)) // May be to naive - possibly should use some advanced method like ComparePropertyValues..
{
bool keepExisting = KeepExistingValue(value, extValue, mergeBehavior, classMap, propertyMap, existing, obj, propStatus, extPropStatus, forOrgValue);
if (!keepExisting)
{
if (forOrgValue)
{
om.SetPropertyValue(existing, propertyMap.Name, value);
om.SetNullValueStatus(existing, propertyMap.Name, om.GetNullValueStatus(obj, propertyMap.Name));
if (propStatus == PropertyStatus.Dirty)
{
this.Context.UnitOfWork.RegisterDirty(existing);
om.SetUpdatedStatus(existing, propertyMap.Name, true);
}
}
else
{
om.SetOriginalPropertyValue(existing, propertyMap.Name, value);
}
}
}
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:24,代码来源:PersistenceManager.cs
示例18: MergePrimitiveProperty
private void MergePrimitiveProperty(IObjectManager om, object obj, IClassMap classMap, IPropertyMap propertyMap, object existing, bool forOrgValue, PropertyStatus propStatus, PropertyStatus extPropStatus, MergeBehaviorType mergeBehavior)
{
if (forOrgValue)
{
object value = om.GetPropertyValue(obj, propertyMap.Name);
object extValue = om.GetPropertyValue(existing, propertyMap.Name);
MergePrimitivePropertyValues(value, extValue, propStatus, extPropStatus, om, existing, classMap, propertyMap, obj, forOrgValue, mergeBehavior);
}
else
{
object orgValue = om.GetOriginalPropertyValue(obj, propertyMap.Name);
object extOrgValue = om.GetOriginalPropertyValue(existing, propertyMap.Name);
MergePrimitivePropertyValues(orgValue, extOrgValue, propStatus, extPropStatus, om, existing, classMap, propertyMap, obj, forOrgValue, mergeBehavior);
}
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:15,代码来源:PersistenceManager.cs
示例19: GetDeleteOptimisticConcurrencyBehavior
public virtual OptimisticConcurrencyBehaviorType GetDeleteOptimisticConcurrencyBehavior(OptimisticConcurrencyBehaviorType optimisticConcurrencyBehavior, IPropertyMap propertyMap)
{
IColumnMap columnMap = null;
if (optimisticConcurrencyBehavior == OptimisticConcurrencyBehaviorType.DefaultBehavior)
{
if (this.Context.OptimisticConcurrencyMode == OptimisticConcurrencyMode.Disabled)
{
optimisticConcurrencyBehavior = OptimisticConcurrencyBehaviorType.Disabled;
}
else
{
optimisticConcurrencyBehavior = propertyMap.DeleteOptimisticConcurrencyBehavior;
if (optimisticConcurrencyBehavior == OptimisticConcurrencyBehaviorType.DefaultBehavior)
{
optimisticConcurrencyBehavior = propertyMap.ClassMap.DeleteOptimisticConcurrencyBehavior;
if (optimisticConcurrencyBehavior == OptimisticConcurrencyBehaviorType.DefaultBehavior)
{
optimisticConcurrencyBehavior = propertyMap.ClassMap.DomainMap.DeleteOptimisticConcurrencyBehavior;
if (optimisticConcurrencyBehavior == OptimisticConcurrencyBehaviorType.DefaultBehavior)
{
optimisticConcurrencyBehavior = m_DeleteOptimisticConcurrencyBehavior;
}
}
}
}
}
if (optimisticConcurrencyBehavior == OptimisticConcurrencyBehaviorType.DefaultBehavior)
{
columnMap = propertyMap.GetColumnMap();
if (columnMap != null)
{
if (columnMap.DataType == DbType.AnsiString || columnMap.DataType == DbType.AnsiStringFixedLength || columnMap.DataType == DbType.String || columnMap.DataType == DbType.StringFixedLength)
{
if (columnMap.Precision == 0 || columnMap.Precision >= 4000)
{
optimisticConcurrencyBehavior = OptimisticConcurrencyBehaviorType.Disabled;
}
else
{
optimisticConcurrencyBehavior = OptimisticConcurrencyBehaviorType.IncludeWhenLoaded;
}
}
else if (columnMap.DataType == DbType.Binary || columnMap.DataType == DbType.Object)
{
optimisticConcurrencyBehavior = OptimisticConcurrencyBehaviorType.Disabled;
}
else
{
optimisticConcurrencyBehavior = OptimisticConcurrencyBehaviorType.IncludeWhenLoaded;
}
}
}
else
{
if (!(optimisticConcurrencyBehavior == OptimisticConcurrencyBehaviorType.Disabled))
{
if (propertyMap.DeleteOptimisticConcurrencyBehavior == OptimisticConcurrencyBehaviorType.DefaultBehavior)
{
columnMap = propertyMap.GetColumnMap();
if (columnMap != null)
{
if (columnMap.DataType == DbType.AnsiString || columnMap.DataType == DbType.AnsiStringFixedLength || columnMap.DataType == DbType.String || columnMap.DataType == DbType.StringFixedLength)
{
if (columnMap.Precision == 0 || columnMap.Precision >= 4000)
{
optimisticConcurrencyBehavior = OptimisticConcurrencyBehaviorType.Disabled;
}
}
else if (columnMap.DataType == DbType.Binary || columnMap.DataType == DbType.Object)
{
optimisticConcurrencyBehavior = OptimisticConcurrencyBehaviorType.Disabled;
}
}
}
}
}
if (columnMap == null)
{
columnMap = propertyMap.GetColumnMap();
}
if (columnMap != null)
{
if (columnMap.DataType == DbType.Binary || columnMap.DataType == DbType.Object)
{
optimisticConcurrencyBehavior = OptimisticConcurrencyBehaviorType.Disabled;
}
}
return optimisticConcurrencyBehavior;
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:89,代码来源:PersistenceManager.cs
示例20: GetRefreshBehavior
public virtual RefreshBehaviorType GetRefreshBehavior(RefreshBehaviorType refreshBehavior, IClassMap classMap, IPropertyMap propertyMap)
{
if (refreshBehavior == RefreshBehaviorType.DefaultBehavior)
{
if (this.Context.OptimisticConcurrencyMode == OptimisticConcurrencyMode.Early)
{
refreshBehavior = RefreshBehaviorType.ThrowConcurrencyException ;
}
else
{
refreshBehavior = propertyMap.RefreshBehavior;
if (refreshBehavior == RefreshBehaviorType.DefaultBehavior)
{
refreshBehavior = classMap.RefreshBehavior;
if (refreshBehavior == RefreshBehaviorType.DefaultBehavior)
{
refreshBehavior = classMap.DomainMap.RefreshBehavior;
if (refreshBehavior == RefreshBehaviorType.DefaultBehavior)
{
refreshBehavior = m_RefreshBehavior;
if (refreshBehavior == RefreshBehaviorType.DefaultBehavior)
{
refreshBehavior = RefreshBehaviorType.OverwriteNotLoaded;
}
}
}
}
}
}
return refreshBehavior;
}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:31,代码来源:PersistenceManager.cs
注:本文中的IPropertyMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论