本文整理汇总了C#中IObjectDefinition类的典型用法代码示例。如果您正苦于以下问题:C# IObjectDefinition类的具体用法?C# IObjectDefinition怎么用?C# IObjectDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IObjectDefinition类属于命名空间,在下文中一共展示了IObjectDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckConfigurationClassCandidate
/// <summary>
/// Checks the class to see if it is a candidate to be a <see cref="ConfigurationAttribute"/> source.
/// </summary>
/// <param name="objectDefinition">The object definition.</param>
/// <returns></returns>
public static bool CheckConfigurationClassCandidate(IObjectDefinition objectDefinition)
{
Type objectType = null;
if (objectDefinition is AbstractObjectDefinition)
{
AbstractObjectDefinition definition = (AbstractObjectDefinition)objectDefinition;
if (definition.HasObjectType)
{
objectType = definition.ObjectType;
}
else
{
if (definition.ObjectTypeName != null)
{
objectType = TypeResolutionUtils.ResolveType(definition.ObjectTypeName);
}
}
if (objectType != null)
{
if (Attribute.GetCustomAttribute(objectType, typeof(ConfigurationAttribute)) != null)
{
return true;
}
if (Attribute.GetCustomAttribute(objectType, typeof(ComponentAttribute)) != null ||
HasAttributeOnMethods(objectType, typeof(DefinitionAttribute)))
{
return true;
}
}
}
return false;
}
开发者ID:AnthonySteele,项目名称:spring-net-codeconfig,代码行数:37,代码来源:ConfigurationClassObjectDefinitionReader.cs
示例2: Add
public void Add(string key, IObjectDefinition value)
{
lock(SyncRoot)
{
base[key] = value;
}
}
示例3: ParseChild
private static string ParseChild(XmlElement element, ParserContext parserContext, IObjectDefinition parentDefinition)
{
IObjectDefinition def = parserContext.ParserHelper.ParseCustomElement(element, parentDefinition);
if(def == null) {
parserContext.ReaderContext.ReportException(element, element.Name, "child ObjectDefinition must not be null");
}
return parserContext.ReaderContext.RegisterWithGeneratedName(def);
}
示例4: GenericObjectDefinition
/// <summary>
/// Creates a new <see cref="GenericObjectDefinition"/> as deep copy of the given
/// object definition.
/// </summary>
/// <param name="original">the original object definition to copy from</param>
public GenericObjectDefinition(IObjectDefinition original)
: base(original)
{
GenericObjectDefinition god = original as GenericObjectDefinition;
if (god != null)
{
this.parentName = god.parentName;
}
}
示例5: CreateCollectionAttributes
protected static IDictionary<string, IAttributeDefinition> CreateCollectionAttributes(IObjectDefinition od)
{
IDictionary<string, IAttributeDefinition> attrs = new Dictionary<string,IAttributeDefinition>();
attrs.Add("ID",new AttributeDefinition(od, "ID", "业务单号", "busnum", OleDbType.VarWChar, 20, 0, true));
attrs.Add("CustomerName",new AttributeDefinition(od, "CustomerName", "客户姓名", "clientname", OleDbType.VarWChar, 10, 1, false, true));
attrs.Add("Value",new AttributeDefinition(od, "Value", "收款金额", "moneys", OleDbType.VarWChar, 10, 2));
attrs.Add("Offset",new AttributeDefinition(od, "Offset", "退补金额", "moneyt", OleDbType.VarWChar, 10, 3));
return attrs;
}
示例6: GenerateObjectName
/// <summary>
/// Generates an object name for the given object definition.
/// </summary>
/// <param name="definition">The object definition to generate a name for.</param>
/// <param name="registry">The object definitions registry that the given definition is
/// supposed to be registerd with</param>
/// <returns>
/// the generated object name
/// </returns>
public string GenerateObjectName(IObjectDefinition definition, IObjectDefinitionRegistry registry)
{
if (definition is ScannedGenericObjectDefinition)
{
string objectName = ((ScannedGenericObjectDefinition) definition).ComponentName;
if (!string.IsNullOrEmpty(objectName))
return objectName;
}
return BuildDefaultObjectName(definition);
}
示例7: ResolveDependency
protected override object ResolveDependency(string objectName, IObjectDefinition objectDefinition, IObjectWrapper objectWrapper, PropertyInfo propertyInfo)
{
if (!propertyInfo.PropertyType.IsInterface)
{
return null;
}
Type mockType = typeof(Mock).MakeGenericType(propertyInfo.PropertyType);
Mock mock = (Mock)Activator.CreateInstance(mockType, defaultMockBehavior);
return mock.Object;
}
示例8: CreateCustomerAttributes
protected static IDictionary<string, IAttributeDefinition> CreateCustomerAttributes(IObjectDefinition od)
{
IDictionary<string, IAttributeDefinition> attrs = new Dictionary<string,IAttributeDefinition>();
attrs.Add("ID", new AttributeDefinition(od,"ID", "客户身份证号", "clientnum",OleDbType.VarWChar, 20, 0,true));
attrs.Add("Name", new AttributeDefinition(od, "Name", "客户姓名", "clientname", OleDbType.VarWChar, 10, 1,true));
attrs.Add("Sex", new AttributeDefinition(od, "Sex", "客户性别", "clientsex", OleDbType.VarWChar, 10, 2));
attrs.Add("Phone", new AttributeDefinition(od, "Phone", "联系电话", "clientphone", OleDbType.VarWChar, 20, 3));
attrs.Add("Address", new AttributeDefinition(od, "Address", "收件地址", "clientaddress", OleDbType.VarWChar, 225, 4));
return attrs;
}
示例9: GenerateObjectName
public string GenerateObjectName(IObjectDefinition definition, IObjectDefinitionRegistry registry)
{
var objectDefinition = definition as ScannedGenericObjectDefinition;
if (objectDefinition != null)
{
string componentName = objectDefinition.ComponentName;
if (!string.IsNullOrEmpty(componentName))
return componentName;
}
return BuildDefaultObjectName(definition);
}
示例10: GenerateObjectName
/// <summary>
/// Generates an object name for the given object definition.
/// </summary>
/// <param name="definition">The object definition to generate a name for.</param>
/// <param name="registry">The object definitions registry that the given definition is
/// supposed to be registerd with</param>
/// <returns>the generated object name</returns>
public string GenerateObjectName(IObjectDefinition definition, IObjectDefinitionRegistry registry)
{
IConfigurableObjectDefinition objectDef = definition as IConfigurableObjectDefinition;
if (objectDef == null)
{
throw new ArgumentException(
"DefaultObjectNameGenerator is only able to handle IConfigurableObjectDefinition subclasses: " +
definition);
}
return ObjectDefinitionReaderUtils.GenerateObjectName(objectDef, registry);
}
示例11: CreateCaseAttributes
protected static IDictionary<string, IAttributeDefinition> CreateCaseAttributes(IObjectDefinition od)
{
IDictionary<string, IAttributeDefinition> attrs = new Dictionary<string,IAttributeDefinition>();
attrs.Add("ID", new AttributeDefinition(od, "ID", "业务单号", "busnum", OleDbType.VarWChar, 20, 0, true));
attrs.Add("AppType", new AttributeDefinition(od, "AppType", "业务类别", "busstyle", OleDbType.VarWChar, 10, 1, false, true));
attrs.Add("CustomerName", new AttributeDefinition(od, "CustomerName", "客户姓名", "clientname", OleDbType.VarWChar, 10, 2, false, true));
attrs.Add("CustomerID", new AttributeDefinition(od, "CustomerID", "客户身份证号", "clientnum", OleDbType.VarWChar, 20, 3, false, true));
attrs.Add("Region", new AttributeDefinition(od, "Region", "申请国家", "applycountry", OleDbType.VarWChar, 10, 4, false, true));
attrs.Add("Type", new AttributeDefinition(od, "Type", "问题案类型", "prostyle", OleDbType.VarWChar, 10, 5));
attrs.Add("Text", new AttributeDefinition(od, "Text", "问题案信息", "protext", OleDbType.VarWChar, 255, 6));
return attrs;
}
示例12: VisitObjectDefinition
/// <summary>
/// Traverse the given ObjectDefinition object and the MutablePropertyValues
/// and ConstructorArgumentValues contained in them.
/// </summary>
/// <param name="definition">The object definition to traverse.</param>
public virtual void VisitObjectDefinition(IObjectDefinition definition)
{
VisitObjectTypeName(definition);
VisitPropertyValues(definition);
ConstructorArgumentValues cas = definition.ConstructorArgumentValues;
if (cas != null)
{
VisitIndexedArgumentValues(cas.IndexedArgumentValues);
VisitNamedArgumentValues(cas.NamedArgumentValues);
VisitGenericArgumentValues(cas.GenericArgumentValues);
}
}
示例13: AttributeDefinition
public AttributeDefinition(IObjectDefinition od, string name, string label, string column, OleDbType type,
int? length, int orderIndex, bool isRequired, bool isReadOnly)
{
Name = name;
Label = label;
Column = column;
DataType = type;
Length = length;
OrderIndex = orderIndex;
IsRequired = isRequired;
ForObject = od;
IsReadOnly = isReadOnly;
ShowInList = true;
}
示例14: CreateApplicationAttributes
protected static IDictionary<string, IAttributeDefinition> CreateApplicationAttributes(IObjectDefinition od)
{
IDictionary<string, IAttributeDefinition> attrs = new Dictionary<string,IAttributeDefinition>();
attrs.Add("ID", new AttributeDefinition(od, "ID", "业务单号", "busnum", OleDbType.VarWChar, 20, 0, true));
attrs.Add("Type", new AttributeDefinition(od, "Type", "业务类别", "busstyle", OleDbType.VarWChar, 10, 1,false,true));
attrs.Add("SubType", new AttributeDefinition(od, "SubType", "数量", "buscount", OleDbType.VarWChar, 10, 2, false, true));
attrs.Add("CustomerName", new AttributeDefinition(od, "CustomerName", "客户姓名", "clientname", OleDbType.VarWChar, 10, 3,false,true));
attrs.Add("CustomerSex", new AttributeDefinition(od, "CustomerSex", "客户性别", "clientsex", OleDbType.VarWChar, 10, 4,false,true));
attrs.Add("CustomerID", new AttributeDefinition(od, "CustomerID", "客户身份证号", "clientnum", OleDbType.VarWChar, 20, 5));
attrs.Add("Region", new AttributeDefinition(od, "Region", "申请国家", "applycountry", OleDbType.VarWChar, 10, 6));
attrs.Add("DateApplied", new AttributeDefinition(od, "DateApplied", "申请日期", "applydate", OleDbType.Date, 10, 7));
attrs.Add("DateTraved", new AttributeDefinition(od, "DateTraved", "启程日期", "traveldate", OleDbType.Date, 20, 8) { ShowInList = false });
attrs.Add("OffNoteNo", new AttributeDefinition(od, "OffNoteNo", "照会号", "offnotenum", OleDbType.VarWChar, 10, 9) { ShowInList = false });
attrs.Add("OffNoteDate", new AttributeDefinition(od, "OffNoteDate", "照会日期", "offnotedate", OleDbType.Date, 20, 10) { ShowInList = false });
attrs.Add("Remark", new AttributeDefinition(od, "Remark", "材料说明", "remark", OleDbType.VarWChar, 255, 11) { ShowInList = false });
return attrs;
}
示例15: CreateAttributes
public static IDictionary<string, IAttributeDefinition> CreateAttributes(string entityName, IObjectDefinition od)
{
switch (entityName)
{
case "Application":
return CreateApplicationAttributes(od);
case "Customer":
return CreateCustomerAttributes(od);
case "Case":
return CreateCaseAttributes(od);
case "Collection":
return CreateCollectionAttributes(od);
case "Status":
return CreateStatusAttributes(od);
case "User":
return CreateUserAttributes(od);
default:
Debug.Assert(false,"Encounter an unknown object type "+entityName);
return new Dictionary<string,IAttributeDefinition>();
}
}