本文整理汇总了C#中MutablePropertyValues.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# MutablePropertyValues.ToString方法的具体用法?C# MutablePropertyValues.ToString怎么用?C# MutablePropertyValues.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MutablePropertyValues
的用法示例。
在下文中一共展示了MutablePropertyValues.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterObjectDefinition
/// <summary>
/// Get all property values, given a prefix (which will be stripped)
/// and add the object they define to the factory with the given name
/// </summary>
/// <param name="name">The name of the object to define.</param>
/// <param name="id">
/// The <see cref="System.Collections.IDictionary"/> containing string pairs.
/// </param>
/// <param name="prefix">The prefix of each entry, which will be stripped.</param>
/// <param name="resourceDescription">
/// The description of the resource that the
/// <see cref="System.Collections.IDictionary"/> came from (for logging purposes).
/// </param>
/// <exception cref="Spring.Objects.ObjectsException">
/// In case of loading or parsing errors.
/// </exception>
protected void RegisterObjectDefinition(
string name, IDictionary id, string prefix, string resourceDescription)
{
string typeName = null;
string parent = null;
bool singleton = true;
bool lazyInit = false;
MutablePropertyValues pvs = new MutablePropertyValues();
foreach (string key in id.Keys)
{
if (key.StartsWith(prefix + Separator))
{
string property = key.Substring(prefix.Length + Separator.Length);
if (property.Equals(ClassKey))
{
typeName = (string) id[key];
}
else if (property.Equals(SingletonKey))
{
string val = (string) id[key];
singleton = (val == null) || val.Equals(TrueValue);
}
else if (property.Equals(LazyInitKey))
{
string val = (string) id[key];
lazyInit = val.Equals(TrueValue);
}
else if (property.Equals(ParentKey))
{
parent = (string) id[key];
}
else if (property.EndsWith(RefSuffix))
{
// This isn't a real property, but a reference to another prototype
// Extract property name: property is of form dog(ref)
property = property.Substring(0, property.Length - RefSuffix.Length);
string reference = (String) id[key];
// It doesn't matter if the referenced object hasn't yet been registered:
// this will ensure that the reference is resolved at runtime
// Default is not to use singleton
object val = new RuntimeObjectReference(reference);
pvs.Add(new PropertyValue(property, val));
}
else
{
// normal object property
object val = id[key];
if (val is String)
{
string strVal = (string) val;
// if it starts with a reference prefix...
if (strVal.StartsWith(RefPrefix))
{
// expand reference
string targetName = strVal.Substring(1);
if (targetName.StartsWith(RefPrefix))
{
// escaped prefix -> use plain value
val = targetName;
}
else
{
val = new RuntimeObjectReference(targetName);
}
}
}
pvs.Add(new PropertyValue(property, val));
}
}
}
if (log.IsDebugEnabled)
{
log.Debug(pvs.ToString());
}
if (parent == null)
{
log.Debug(this.DefaultParentObject);
parent = this.DefaultParentObject;
}
if (typeName == null && parent == null)
{
throw new ObjectDefinitionStoreException(resourceDescription, name,
//.........这里部分代码省略.........