本文整理汇总了C#中IObjectDefinition类的典型用法代码示例。如果您正苦于以下问题:C# IObjectDefinition类的具体用法?C# IObjectDefinition怎么用?C# IObjectDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IObjectDefinition类属于命名空间,在下文中一共展示了IObjectDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:Binodesk,项目名称:spring-net,代码行数:7,代码来源:HttpApplicationConfigurer.cs
示例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);
}
开发者ID:rlxrlxrlx,项目名称:spring-net-integration,代码行数:8,代码来源:ChainParser.cs
示例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;
}
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:14,代码来源:GenericObjectDefinition.cs
示例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;
}
开发者ID:baikangwang,项目名称:TJVISA,代码行数:9,代码来源:AttributeDefinitionFactory.cs
示例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);
}
开发者ID:fgq841103,项目名称:spring-net,代码行数:19,代码来源:AttributeObjectNameGenerator.cs
示例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;
}
开发者ID:eeichinger,项目名称:pons,代码行数:10,代码来源:MoqAutoMockingPostProcessor.cs
示例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;
}
开发者ID:baikangwang,项目名称:TJVISA,代码行数:10,代码来源:AttributeDefinitionFactory.cs
示例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);
}
开发者ID:ericklombardo,项目名称:Nuaguil.Net,代码行数:11,代码来源:TypeObjectNameGenerator.cs
示例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);
}
开发者ID:fgq841103,项目名称:spring-net,代码行数:18,代码来源:DefaultObjectNameGenerator.cs
示例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;
}
开发者ID:baikangwang,项目名称:TJVISA,代码行数:12,代码来源:AttributeDefinitionFactory.cs
示例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);
}
}
开发者ID:smnbss,项目名称:spring-net,代码行数:18,代码来源:ObjectDefinitionVisitor.cs
示例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;
}
开发者ID:baikangwang,项目名称:TJVISA,代码行数:14,代码来源:IAttributeDefinition.cs
示例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;
}
开发者ID:baikangwang,项目名称:TJVISA,代码行数:17,代码来源:AttributeDefinitionFactory.cs
示例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>();
}
}
开发者ID:baikangwang,项目名称:TJVISA,代码行数:22,代码来源:AttributeDefinitionFactory.cs
示例16: GetConstructors
// CLOVER:ON
#endregion
/// <summary>
/// Gets those <see cref="System.Reflection.ConstructorInfo"/>s
/// that are applicable for autowiring the supplied <paramref name="definition"/>.
/// </summary>
/// <param name="definition">
/// The <see cref="Spring.Objects.Factory.Config.IObjectDefinition"/>
/// (definition) that is being autowired by constructor.
/// </param>
/// <param name="minimumArgumentCount">
/// The absolute minimum number of arguments that any returned constructor
/// must have. If this parameter is equal to zero (0), then all constructors
/// are valid (regardless of their argument count), including any default
/// constructor.
/// </param>
/// <returns>
/// Those <see cref="System.Reflection.ConstructorInfo"/>s
/// that are applicable for autowiring the supplied <paramref name="definition"/>.
/// </returns>
public static ConstructorInfo[] GetConstructors(
IObjectDefinition definition, int minimumArgumentCount)
{
const BindingFlags flags =
BindingFlags.Public | BindingFlags.NonPublic
| BindingFlags.Instance | BindingFlags.DeclaredOnly;
ConstructorInfo[] constructors = null;
if (minimumArgumentCount > 0)
{
MemberInfo[] ctors = definition.ObjectType.FindMembers(
MemberTypes.Constructor,
flags,
new MemberFilter(new CriteriaMemberFilter().FilterMemberByCriteria),
new MinimumArgumentCountCriteria(minimumArgumentCount));
constructors = (ConstructorInfo[]) ArrayList.Adapter(ctors).ToArray(typeof (ConstructorInfo));
}
else
{
constructors = definition.ObjectType.GetConstructors(flags);
}
AutowireUtils.SortConstructors(constructors);
return constructors;
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:45,代码来源:AutowireUtils.cs
示例17: PostProcessObjectNameAndAliases
protected override string PostProcessObjectNameAndAliases(string objectName, List<string> aliases, XmlElement element, IObjectDefinition containingDefinition)
{
string url = element.GetAttribute(ObjectDefinitionConstants.TypeAttribute);
string strTypeName = url.ToLower();
if (strTypeName.EndsWith(".aspx"))
{
if (!StringUtils.HasText(objectName))
{
objectName = webObjectNameGenerator.CreatePageDefinitionName(url);
}
// strip leading homepath symbol ('~') from aliases if necessary
for (int ai = 0; ai < aliases.Count; ai++)
{
string alias = (string)aliases[ai];
if (alias != null && alias.Length > 0 && alias[0] == '~')
{
aliases[ai] = "/" + alias.Substring(1).TrimStart('/', '\\');
}
}
}
else if (strTypeName.EndsWith(".ascx") || strTypeName.EndsWith(".master"))
{
string controlName = webObjectNameGenerator.CreateControlDefinitionName(url);
if (!StringUtils.HasText(objectName))
{
objectName = controlName;
}
else
{
aliases.Add(controlName);
}
}
return objectName;
}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:36,代码来源:WebObjectDefinitionParserHelper.cs
示例18: PostProcessObjectNameAndAliases
/// <summary>
/// Allows deriving classes to post process the name and aliases for the current element. By default
/// does nothing and returns the unmodified <paramref name="objectName"/>.
/// </summary>
/// <remarks>
/// The <paramref name="aliases"/> list passed in may be modified by an implementation of this method to reflect special needs.
/// </remarks>
/// <param name="objectName">the object name obtained by the default algorithm from 'id' and 'name' attributes so far.</param>
/// <param name="aliases">the object aliases obtained by the default algorithm from 'name' attribute so far.</param>
/// <param name="element">the currently processed element.</param>
/// <param name="containingDefinition">the containing object definition, may be <c>null</c></param>
/// <returns>the new object name to be used.</returns>
protected virtual string PostProcessObjectNameAndAliases(string objectName, List<string> aliases, XmlElement element, IObjectDefinition containingDefinition)
{
if (!StringUtils.HasText(objectName) && aliases.Count == 0)
{
string result = this.objectsNamespaceParser.CalculateId(element, aliases);
if (result != null)
{
return result;
}
}
return objectName;
}
开发者ID:tobi-tobsen,项目名称:spring-net,代码行数:24,代码来源:ObjectDefinitionParserHelper.cs
示例19: ConfigureObject
/// <summary>
/// Injects dependencies into the supplied <paramref name="target"/> instance
/// using the supplied <paramref name="definition"/>.
/// </summary>
/// <param name="target">
/// The object instance that is to be so configured.
/// </param>
/// <param name="name">
/// The name of the object definition expressing the dependencies that are to
/// be injected into the supplied <parameref name="target"/> instance.
/// </param>
/// <param name="definition">
/// An object definition that should be used to configure object.
/// </param>
/// <seealso cref="Spring.Objects.Factory.IObjectFactory.ConfigureObject(object, string)"/>
public object ConfigureObject(object target, string name, IObjectDefinition definition)
{
return ObjectFactory.ConfigureObject(target, name, definition);
}
开发者ID:japerr,项目名称:spring-net,代码行数:19,代码来源:AbstractApplicationContext.cs
示例20: ParseCustomElement
/// <summary>
/// Parses an element in a custom namespace.
/// </summary>
/// <param name="ele"></param>
/// <param name="containingDefinition">if a nested element, the containing object definition</param>
/// <returns>the parsed object definition or null if not supported by the corresponding parser.</returns>
public IObjectDefinition ParseCustomElement(XmlElement ele, IObjectDefinition containingDefinition)
{
String namespaceUri = ele.NamespaceURI;
INamespaceParser handler = NamespaceParserRegistry.GetParser(namespaceUri);
if (handler == null)
{
Error("Unable to locate Spring NamespaceHandler for XML schema namespace [" + namespaceUri + "]", ele);
return null;
}
return handler.ParseElement(ele, new ParserContext(this, containingDefinition));
}
开发者ID:tobi-tobsen,项目名称:spring-net,代码行数:17,代码来源:ObjectDefinitionParserHelper.cs
注:本文中的IObjectDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论