本文整理汇总了C#中System.Environment.AddChildNode方法的典型用法代码示例。如果您正苦于以下问题:C# Environment.AddChildNode方法的具体用法?C# Environment.AddChildNode怎么用?C# Environment.AddChildNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Environment
的用法示例。
在下文中一共展示了Environment.AddChildNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Inventorize
public void Inventorize(Type t, Environment.ConfigSectionNode root)
{
if (!typeof(Record).IsAssignableFrom(t)) return;
if (t.IsAbstract) return;
if (t.ContainsGenericParameters) return;
var rec = Record.Make(t);
var rnode = root.AddChildNode("record-model");
rnode.AddAttributeNode("clr-type-ns", t.Namespace);
rnode.AddAttributeNode("clr-type", t.Name);
rnode.AddAttributeNode("clr-type-full", t.FullName);
rnode.AddAttributeNode("table", rec.TableName);
rnode.AddAttributeNode("store-flag", rec.StoreFlag.ToString());
rnode.AddAttributeNode("case-sensitive", rec.CaseSensitiveFieldBinding);
rnode.AddAttributeNode("permission", rec.PermissionName);
rnode.AddAttributeNode("permission-namespace", rec.PermissionNamespace);
rnode.AddAttributeNode("throw-init-validation", rec.ThrowOnInitValidation);
rnode.AddAttributeNode("visible", rec.Visible);
foreach(var f in rec.Fields)
{
var fnode = rnode.AddChildNode("field");
fnode.AddAttributeNode("name", f.FieldName);
fnode.AddAttributeNode("type", f.GetFieldDataType().FullName);
fnode.AddAttributeNode("calc-override", f.AllowCalculationOverride);
fnode.AddAttributeNode("calculated", f.Calculated);
fnode.AddAttributeNode("entry-type", f.DataEntryType.ToString());
fnode.AddAttributeNode("description", f.Description);
fnode.AddAttributeNode("display-format", f.DisplayFormat);
fnode.AddAttributeNode("display-h-align", f.DisplayTextHAlignment.ToString());
fnode.AddAttributeNode("display-width", f.DisplayWidth);
fnode.AddAttributeNode("has-default-value", f.HasDefaultValue);
fnode.AddAttributeNode("hint", f.Hint);
fnode.AddAttributeNode("keep-in-errored-field", f.KeepInErroredField);
fnode.AddAttributeNode("key", f.KeyField);
fnode.AddAttributeNode("order", f.LogicalOrder);
fnode.AddAttributeNode("lookup-type", f.LookupType);
InventorizationManager.WriteType(f.GetFieldDataType(), fnode.AddChildNode("data-type"));
if (f.LookupDictionary.Count>0)
{
var dnode = fnode.AddChildNode("lookup-dictionary");
foreach(var key in f.LookupDictionary.Keys)
{
var inode = dnode.AddChildNode("item");
inode.AddAttributeNode("key", key);
inode.AddAttributeNode("value", f.LookupDictionary[key]);
}
}
fnode.AddAttributeNode("permission", f.PermissionName);
fnode.AddAttributeNode("permission-namespace", f.PermissionNamespace);
fnode.AddAttributeNode("readonly", f.Readonly);
fnode.AddAttributeNode("required", f.Required);
fnode.AddAttributeNode("store-flag", f.StoreFlag.ToString());
fnode.AddAttributeNode("throw-init-validation", f.ThrowOnInitValidation);
fnode.AddAttributeNode("visible", f.Visible);
if (f is StringField)
{
var sf = (StringField)f;
fnode.AddAttributeNode("size", sf.Size);
fnode.AddAttributeNode("char-case", sf.CharCase.ToString());
fnode.AddAttributeNode("password", sf.Password);
fnode.AddAttributeNode("regexp", sf.FormatRegExp);
fnode.AddAttributeNode("regexp-description", sf.FormatRegExpDescription);
}
else
if (f is IntField)
{
var castf = (IntField)f;
fnode.AddAttributeNode("min-max-check", castf.MinMaxChecking);
fnode.AddAttributeNode("min-value", castf.MinValue);
fnode.AddAttributeNode("max-value", castf.MaxValue);
fnode.AddAttributeNode("default-value", castf.DefaultValue);
}else
if (f is LongField)
{
var castf = (LongField)f;
fnode.AddAttributeNode("min-max-check", castf.MinMaxChecking);
fnode.AddAttributeNode("min-value", castf.MinValue);
fnode.AddAttributeNode("max-value", castf.MaxValue);
fnode.AddAttributeNode("default-value", castf.DefaultValue);
}else
if (f is ShortField)
{
var castf = (ShortField)f;
fnode.AddAttributeNode("min-max-check", castf.MinMaxChecking);
fnode.AddAttributeNode("min-value", castf.MinValue);
fnode.AddAttributeNode("max-value", castf.MaxValue);
fnode.AddAttributeNode("default-value", castf.DefaultValue);
}else
//.........这里部分代码省略.........