本文整理汇总了C#中System.Reflection.PropertyInfo.GetExtendedMemberInfoString方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyInfo.GetExtendedMemberInfoString方法的具体用法?C# PropertyInfo.GetExtendedMemberInfoString怎么用?C# PropertyInfo.GetExtendedMemberInfoString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.PropertyInfo
的用法示例。
在下文中一共展示了PropertyInfo.GetExtendedMemberInfoString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValue
public override object GetValue(PropertyInfo propertyInfo)
{
MemoryUniqueValueGenerator.Logger.Debug($"Entering GetValue. propertyInfo: {propertyInfo.GetExtendedMemberInfoString()}");
if (propertyInfo.PropertyType == typeof (Guid))
{
MemoryUniqueValueGenerator.Logger.Debug("Property type is Guid. Returning new Guid.");
Guid result = Guid.NewGuid();
MemoryUniqueValueGenerator.Logger.Debug($"result: {result}");
return result;
}
var primaryKeyAttribute = this.attributeDecorator.GetSingleAttribute<PrimaryKeyAttribute>(propertyInfo);
if (primaryKeyAttribute == null)
{
MemoryUniqueValueGenerator.Logger.Debug("primaryKeyAttribute == null");
object result = base.GetValue(propertyInfo);
MemoryUniqueValueGenerator.Logger.Debug($"result fom base: {result}");
return result ?? Helper.GetDefaultValue(propertyInfo.PropertyType);
}
if (primaryKeyAttribute.KeyType == PrimaryKeyAttribute.KeyTypeEnum.Manual
|| primaryKeyAttribute.KeyType == PrimaryKeyAttribute.KeyTypeEnum.Auto)
{
MemoryUniqueValueGenerator.Logger.Debug("Deferring value");
this.DeferValue(propertyInfo);
}
MemoryUniqueValueGenerator.Logger.Debug("Exiting GetValue.");
return Helper.GetDefaultValue(propertyInfo.PropertyType);
}
示例2: GetArray
public object GetArray(PropertyInfo propertyInfo, Type type)
{
StandardArrayRandomizer.Logger.Debug($"Entering GetArray. propertyInfo: {propertyInfo.GetExtendedMemberInfoString()}, type: {type}");
Array resultArray;
int rank = type.GetArrayRank();
Type basicType = type.GetElementType();
if (rank > 1)
{
StandardArrayRandomizer.Logger.Debug($"rank > 1: {rank}");
var dimensionSizes = new int[rank];
for (int i = 0; i < dimensionSizes.Length; i++)
{
StandardArrayRandomizer.Logger.Debug($"dimensionSize {i}: {dimensionSizes[i]}");
dimensionSizes[i] = this.random.Next(StandardArrayRandomizer.MaxDimensionLength) + 1;
}
EmptyArrayResult emptyArrayResult = StandardArrayRandomizer.GetEmptyArray(type, dimensionSizes);
do
{
object resultElement = this.valueGenerator.GetValue(propertyInfo, basicType);
StandardArrayRandomizer.Logger.Debug($"Result element: {resultElement}");
emptyArrayResult.Array.SetValue(resultElement, emptyArrayResult.Indices.Value);
emptyArrayResult.Indices++;
} while (!emptyArrayResult.Indices.Overflow);
resultArray = emptyArrayResult.Array;
}
else
{
StandardArrayRandomizer.Logger.Debug($"rank <= 1: {rank}");
int dimensionLength = this.random.Next(StandardArrayRandomizer.MaxDimensionLength) + 1;
ConstructorInfo constructor = type.GetConstructor(new[] { typeof(int) });
resultArray = (Array)constructor.Invoke(new object[] { dimensionLength });
for (int i = 0; i < dimensionLength; i++)
{
object value = this.valueGenerator.GetValue(propertyInfo, basicType);
StandardArrayRandomizer.Logger.Debug($"Element value: {value}");
resultArray.SetValue(value, i);
}
}
StandardArrayRandomizer.Logger.Debug("Exiting GetArray");
return resultArray;
}
示例3: SetProperty
protected override void SetProperty(object objectToFill, PropertyInfo targetPropertyInfo)
{
UniqueValueTypeGenerator.Logger.Debug("Entering SetProperty. targetPropertyInfo: " +
targetPropertyInfo.GetExtendedMemberInfoString());
if (!targetPropertyInfo.PropertyType.IsValueLikeType())
{
UniqueValueTypeGenerator.Logger.Debug("Property type is value like. Calling base.");
base.SetProperty(objectToFill, targetPropertyInfo);
return;
}
object targetPropertyValue = this.accumulatorValueGenerator.GetValue(targetPropertyInfo);
UniqueValueTypeGenerator.Logger.Debug($"targetPropertyValue: {targetPropertyValue}");
targetPropertyInfo.SetValue(objectToFill, targetPropertyValue);
UniqueValueTypeGenerator.Logger.Debug("Exiting SetProperty");
}
示例4: GetValue
public override object GetValue(PropertyInfo propertyInfo)
{
KeyTypeUniqueValueGenerator.Logger.Debug(
$"Entering GetValue. propertyInfo: {propertyInfo.GetExtendedMemberInfoString()}");
var primaryKeyAttribute = this.attributeDecorator.GetSingleAttribute<PrimaryKeyAttribute>(propertyInfo);
if (primaryKeyAttribute == null)
{
KeyTypeUniqueValueGenerator.Logger.Debug("primaryKeyAttribute == null");
object result = base.GetValue(propertyInfo);
KeyTypeUniqueValueGenerator.Logger.Debug($"result fom base: {result}");
return result ?? Helper.GetDefaultValue(propertyInfo.PropertyType);
}
KeyTypeUniqueValueGenerator.Logger.Debug($"primaryKeyAttribute.KeyType: {primaryKeyAttribute.KeyType}");
if (this.attributeDecorator.GetSingleAttribute<ForeignKeyAttribute>(propertyInfo) != null ||
primaryKeyAttribute.KeyType != PrimaryKeyAttribute.KeyTypeEnum.Manual || !new[]
{
typeof (byte), typeof (int), typeof (short), typeof (long), typeof (string),
typeof (uint), typeof (ushort), typeof (ulong),
}.Contains(propertyInfo.PropertyType))
{
KeyTypeUniqueValueGenerator.Logger.Debug("Not deferring value. Exiting GetValue.");
return Helper.GetDefaultValue(propertyInfo.PropertyType);
}
KeyTypeUniqueValueGenerator.Logger.Debug("Deferring value");
this.DeferValue(propertyInfo);
KeyTypeUniqueValueGenerator.Logger.Debug("Exiting GetValue");
return Helper.GetDefaultValue(propertyInfo.PropertyType);
}
示例5: PopulatePrimaryKeyException
public PopulatePrimaryKeyException(string message, PropertyInfo propertyInfo)
: base(string.Format(message, propertyInfo.GetExtendedMemberInfoString()))
{
}
示例6: Write
private string Write(PropertyInfo propertyInfo, GetSelectDelegate getSelectDelegate)
{
SqlWriterCommandTextGenerator.Logger.Debug("Entering Write. propertyInfo: " + propertyInfo.GetExtendedMemberInfoString());
TableName tableName = Helper.GetTableName(propertyInfo.DeclaringType, this.attributeDecorator);
string columnName = Helper.GetColumnName(propertyInfo, this.attributeDecorator);
string result = getSelectDelegate(tableName.CatalogueName, tableName.Schema, tableName.Name, columnName);
SqlWriterCommandTextGenerator.Logger.Debug($"Result statement: {result}");
SqlWriterCommandTextGenerator.Logger.Debug("Exiting Write");
return result;
}
示例7: WriteStringCommand
private DecoderDelegate WriteStringCommand(PropertyInfo propertyInfo)
{
SqlWriterDictionary.Logger.Debug("Entering WriteStringCommand. propertyInfo: " + propertyInfo.GetExtendedMemberInfoString());
string commandText = this.commandTextGenerator.WriteString(propertyInfo);
this.writePrimitives.AddSqlCommand(commandText);
SqlWriterDictionary.Logger.Debug("Exiting WriteStringCommand");
return this.DecodeString;
}
示例8: DecodeString
private LargeInteger DecodeString(PropertyInfo propertyInfo, object input)
{
SqlWriterDictionary.Logger.Debug($"Entering DecodeString. propertyInfo: {propertyInfo.GetExtendedMemberInfoString()}, input: {input}");
if (input is DBNull)
{
SqlWriterDictionary.Logger.Debug("input is DBNull");
return 0;
}
if (input.GetType() != typeof(string))
{
throw new UnexpectedTypeException(string.Format(Messages.UnexpectedHandlerType, propertyInfo, input));
}
LargeInteger result = this.encoder.Decode(((string)input).ToUpper());
SqlWriterDictionary.Logger.Debug("Exiting DecodeString");
return result;
}
示例9: DecodeNumber
private static LargeInteger DecodeNumber(PropertyInfo propertyInfo, object input)
{
SqlWriterDictionary.Logger.Debug($"Entering DecodeNumber. propertyInfo: {propertyInfo.GetExtendedMemberInfoString()}, input: {input}");
if (input is DBNull)
{
SqlWriterDictionary.Logger.Debug("input is DBNull");
return 0;
}
if (
!new[] { typeof(byte), typeof(int), typeof(short), typeof(long) }.Contains(input.GetType()))
{
throw new UnexpectedTypeException(string.Format(Messages.UnexpectedHandlerType, propertyInfo.GetExtendedMemberInfoString(), input));
}
LargeInteger result = (ulong)Convert.ChangeType(input, typeof(ulong));
SqlWriterDictionary.Logger.Debug("Exiting DecodeNumber");
return result;
}