本文整理汇总了C#中ICustomTypeDescriptor类的典型用法代码示例。如果您正苦于以下问题:C# ICustomTypeDescriptor类的具体用法?C# ICustomTypeDescriptor怎么用?C# ICustomTypeDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICustomTypeDescriptor类属于命名空间,在下文中一共展示了ICustomTypeDescriptor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ModelTypeDescriptor
public ModelTypeDescriptor(ICustomTypeDescriptor parent, object instance, IList<ModelProperty> properties)
: base(parent)
{
modelPropertyDescriptors = properties
.Select(p => new ModelPropertyDescriptor(p))
.ToArray();
}
开发者ID:distantcam,项目名称:ModelFuu,代码行数:7,代码来源:ModelTypeDescriptor.cs
示例2: LinqToEntitiesTypeDescriptor
/// <summary>
/// Constructor taking a metadata context, an structural type, and a parent custom type descriptor
/// </summary>
/// <param name="typeDescriptionContext">The <see cref="LinqToEntitiesTypeDescriptionContext"/> context.</param>
/// <param name="edmType">The <see cref="StructuralType"/> type (can be an entity or complex type).</param>
/// <param name="parent">The parent custom type descriptor.</param>
public LinqToEntitiesTypeDescriptor(LinqToEntitiesTypeDescriptionContext typeDescriptionContext, StructuralType edmType, ICustomTypeDescriptor parent)
: base(parent)
{
_typeDescriptionContext = typeDescriptionContext;
_edmType = edmType;
EdmMember[] timestampMembers = _edmType.Members.Where(p => ObjectContextUtilities.IsConcurrencyTimestamp(p)).ToArray();
if (timestampMembers.Length == 1)
{
_timestampMember = timestampMembers[0];
}
if (edmType.BuiltInTypeKind == BuiltInTypeKind.EntityType)
{
// if any FK member of any association is also part of the primary key, then the key cannot be marked
// Editable(false)
EntityType entityType = (EntityType)edmType;
_foreignKeyMembers = new HashSet<EdmMember>(entityType.NavigationProperties.SelectMany(p => p.GetDependentProperties()));
foreach (EdmProperty foreignKeyMember in _foreignKeyMembers)
{
if (entityType.KeyMembers.Contains(foreignKeyMember))
{
_keyIsEditable = true;
break;
}
}
}
}
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:34,代码来源:LinqToEntitiesTypeDescriptor.cs
示例3: DomainTypeDescriptor
public DomainTypeDescriptor(Type entityType, ICustomTypeDescriptor parent, bool keyIsEditable, HashSet<string> foreignKeyMembers)
: base(parent)
{
this._entityType = entityType;
this._keyIsEditable = keyIsEditable;
this._foreignKeyMembers = foreignKeyMembers;
}
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:7,代码来源:DomainTypeDescriptor.cs
示例4: GetTypeDescriptor
//=====================================================================
/// <summary>
/// This gets a custom type descriptor for the given type and object
/// </summary>
/// <param name="objectType">The type of object for which to retrieve the type descriptor.</param>
/// <param name="instance">An instance of the type. This may be null if not instance was passed to the
/// type descriptor.</param>
/// <returns>An <see cref="ICustomTypeDescriptor"/> that can provide metadata for the type</returns>
public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
{
if(customTD == null)
customTD = new ChildPropertyTypeDescriptor(base.GetTypeDescriptor(objectType, instance));
return customTD;
}
开发者ID:modulexcite,项目名称:PDI,代码行数:16,代码来源:ChildPropertyTypeDescriptionProvider.cs
示例5: GetTypeDescriptor
internal static ICustomTypeDescriptor GetTypeDescriptor( Type objectType, ICustomTypeDescriptor descriptor )
{
if( descriptor == null )
return null;
return new DataItemTypeDescriptor( descriptor, objectType );
}
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:7,代码来源:DataItemTypeDescriptionProvider.cs
示例6: GenericTypeDescriptor
public GenericTypeDescriptor(Type objectType, ICustomTypeDescriptor parent)
{
if (objectType == null) throw new ArgumentNullException("objectType");
if (parent == null) throw new ArgumentNullException("parent");
type = objectType;
parentDescriptor = parent;
}
开发者ID:odalet,项目名称:Hawkeye2,代码行数:7,代码来源:GenericTypeDescriptor.cs
示例7: GetTypeDescriptor
/// <summary>
/// Returns a custom type descriptor for the specified type (either an entity or complex type).
/// </summary>
/// <param name="objectType">Type of object for which we need the descriptor</param>
/// <param name="parent">The parent type descriptor</param>
/// <returns>Custom type description for the specified type</returns>
public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, ICustomTypeDescriptor parent)
{
// No need to deal with concurrency... Worst case scenario we have multiple
// instances of this thing.
ICustomTypeDescriptor td = null;
if (!_descriptors.TryGetValue(objectType, out td))
{
// call into base so the TDs are chained
parent = base.GetTypeDescriptor(objectType, parent);
StructuralType edmType = _typeDescriptionContext.GetEdmType(objectType);
if (edmType != null &&
(edmType.BuiltInTypeKind == BuiltInTypeKind.EntityType || edmType.BuiltInTypeKind == BuiltInTypeKind.ComplexType))
{
// only add an LTE TypeDescriptor if the type is an EF Entity or ComplexType
td = new LinqToEntitiesTypeDescriptor(_typeDescriptionContext, edmType, parent);
}
else
{
td = parent;
}
_descriptors[objectType] = td;
}
return td;
}
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:33,代码来源:LinqToEntitiesMetadataProvider.cs
示例8: ComponentImporter
public ComponentImporter(Type type, ICustomTypeDescriptor typeDescriptor) : base(type)
{
if (typeDescriptor == null)
{
typeDescriptor = new Maticsoft.Json.Conversion.CustomTypeDescriptor(type);
}
int num = 0;
PropertyDescriptorCollection properties = typeDescriptor.GetProperties();
IObjectMemberImporter[] importerArray = new IObjectMemberImporter[properties.Count];
for (int i = 0; i < properties.Count; i++)
{
IServiceProvider provider = properties[i] as IServiceProvider;
if (provider != null)
{
IObjectMemberImporter service = (IObjectMemberImporter) provider.GetService(typeof(IObjectMemberImporter));
if (service != null)
{
importerArray[i++] = service;
num++;
}
}
}
this._properties = properties;
if (num > 0)
{
this._importers = importerArray;
}
}
开发者ID:huaminglee,项目名称:myyyyshop,代码行数:28,代码来源:ComponentImporter.cs
示例9: DescriptorBase
/// <summary>
/// Initializes a new instance of the <see cref="T:DescriptorBase"/> class.
/// </summary>
/// <param name="provider">The provider.</param>
/// <param name="parentdescriptor">The parentdescriptor.</param>
/// <param name="objectType">Type of the object.</param>
public DescriptorBase(ShapeProvider provider, ICustomTypeDescriptor parentdescriptor, Type objectType)
: base(parentdescriptor)
{
this.provider = provider;
this.type = objectType;
mProperties = new PropertyDescriptorCollection(null);
}
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:13,代码来源:DescriptorBase.cs
示例10: NHibernateTypeDescriptor
public NHibernateTypeDescriptor(Type entityType, ICustomTypeDescriptor parent,
Configuration nhibernateConfiguration, Type metaDataType)
: base(parent)
{
Type metaDataType1 = metaDataType;
while (entityType != null && entityType.Name.EndsWith("Proxy") &&
entityType.Assembly.GetName().Name.EndsWith("ProxyAssembly"))
entityType = entityType.BaseType;
this.entityType = entityType;
this._nhibernateConfiguration = nhibernateConfiguration;
_classMetadata = nhibernateConfiguration.GetClassMapping(this.entityType);
_identifierCols = _classMetadata.Identifier.ColumnIterator;
if (metaDataType1 != null)
{
var memberInfos =
metaDataType1.GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance);
foreach (var memberInfo in memberInfos)
{
var attributes = memberInfo.GetCustomAttributes(false).Cast<Attribute>();
if (attributes.Any())
_metaDataAttributes.Add(memberInfo.Name, attributes);
}
}
}
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:26,代码来源:NHibernateTypeDescriptor.cs
示例11: GetTypeDescriptor
/// <summary>
/// Returns a custom type descriptor for the specified entity type
/// </summary>
/// <param name="objectType">Type of object for which we need the descriptor</param>
/// <param name="parent">The parent type descriptor</param>
/// <returns>a custom type descriptor for the specified entity type</returns>
public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, ICustomTypeDescriptor parent)
{
// No need to deal with concurrency... Worst case scenario we have multiple
// instances of this thing.
ICustomTypeDescriptor td = null;
if (!this._descriptors.TryGetValue(objectType, out td))
{
// call into base so the TDs are chained
parent = base.GetTypeDescriptor(objectType, parent);
MetaType metaType = this._typeDescriptionContext.MetaModel.GetMetaType(objectType);
if (metaType.IsEntity)
{
// only add an LTS TypeDescriptor if the type is a LTS Entity type
td = new LinqToSqlTypeDescriptor(this._typeDescriptionContext, metaType, parent);
}
else
{
td = parent;
}
this._descriptors[objectType] = td;
}
return td;
}
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:32,代码来源:LinqToSqlDomainServiceDescriptionProvider.cs
示例12: AssociatedMetadataTypeTypeDescriptor
public AssociatedMetadataTypeTypeDescriptor(ICustomTypeDescriptor parent, Type type, Type associatedMetadataType)
: base(parent) {
if (associatedMetadataType != null) {
CheckAssociatedMetadataType(type, associatedMetadataType);
AssociatedMetadataType = associatedMetadataType;
}
}
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:7,代码来源:AssociatedMetadataTypeTypeDescriptor.cs
示例13: ComponentImporter
public ComponentImporter(Type type, ICustomTypeDescriptor typeDescriptor) :
base(type)
{
if (typeDescriptor == null)
typeDescriptor = new CustomTypeDescriptor(type);
int count = 0;
PropertyDescriptorCollection properties = typeDescriptor.GetProperties();
IObjectMemberImporter[] importers = new IObjectMemberImporter[properties.Count];
for (int i = 0; i < properties.Count; i++)
{
IServiceProvider sp = properties[i] as IServiceProvider;
if (sp == null)
continue;
IObjectMemberImporter importer = (IObjectMemberImporter) sp.GetService(typeof(IObjectMemberImporter));
if (importer == null)
continue;
importers[i++] = importer;
count++;
}
_properties = properties;
if (count > 0)
_importers = importers;
}
开发者ID:Ghawken,项目名称:FrontView,代码行数:31,代码来源:ComponentImporter.cs
示例14: DynamicReadOnlyPropertyDescriptor
//=================================================================
/// <summary>
/// Constructor
/// </summary>
/// <param name="typeDescriptor">The type descriptor</param>
/// <param name="propertyDescriptor">The property descriptor</param>
public DynamicReadOnlyPropertyDescriptor(
ICustomTypeDescriptor typeDescriptor,
PropertyDescriptor propertyDescriptor) : base(propertyDescriptor)
{
typeDesc = typeDescriptor;
propDesc = propertyDescriptor;
}
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:14,代码来源:DynamicReadOnlyPropertyDescriptor.cs
示例15: GetTypeDescriptor
public override ICustomTypeDescriptor GetTypeDescriptor(Type type, ICustomTypeDescriptor parent)
{
if (this.LookupIsEntityType(type))
{
return new TableMetadataTypeDescriptor(type, base.GetTypeDescriptor(type, parent));
}
return base.GetTypeDescriptor(type, parent);
}
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:8,代码来源:TableMetadataProvider.cs
示例16: AssociatedMetadataTypeTypeDescriptor
public AssociatedMetadataTypeTypeDescriptor(ICustomTypeDescriptor parent, Type type, Type associatedMetadataType)
: base(parent) {
AssociatedMetadataType = associatedMetadataType ?? TypeDescriptorCache.GetAssociatedMetadataType(type);
IsSelfAssociated = (type == AssociatedMetadataType);
if (AssociatedMetadataType != null) {
TypeDescriptorCache.ValidateMetadataType(type, AssociatedMetadataType);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:AssociatedMetadataTypeTypeDescriptor.cs
示例17: ComponentImporter
public ComponentImporter(Type type, ICustomTypeDescriptor typeDescriptor) :
base(type)
{
if (typeDescriptor == null)
typeDescriptor = new CustomTypeDescriptor(type);
_properties = typeDescriptor.GetProperties();
}
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:8,代码来源:ComponentImporter.cs
示例18: FilteredPropertiesTypeDescriptor
public FilteredPropertiesTypeDescriptor(FilteredPropertiesTypeDescriptorProvider provider, ICustomTypeDescriptor descriptor, Type objType)
: base(descriptor)
{
if (provider == null) throw new ArgumentNullException("provider");
if (descriptor == null) throw new ArgumentNullException("descriptor");
if (objType == null) throw new ArgumentNullException("objectType");
objectType = objType;
}
开发者ID:GeertVL,项目名称:SnippetDesigner,代码行数:8,代码来源:FilteredPropertiesTypeDescriptor.cs
示例19: GetNamedPropertyValue
/// <summary>
/// Gets the value of an <see cref="ICustomTypeDescriptor" />
/// implementation's named property.
/// </summary>
/// <param name="item">
/// The <see cref="ICustomTypeDescriptor" /> implementation, from
/// which to extract a named property's value.
/// </param>
/// <param name="propertyName">
/// The name of the property.
/// </param>
/// <param name="usesCaseSensitivePropertyNameMatch">
/// A value indicating whether the property name match should be
/// case-sensitive.
/// </param>
/// <param name="exceptionThrownIfNoMatch">
/// A value indicating whether an exception should be thrown if
/// no matching property can be found.
/// </param>
/// <returns>
/// The value of the property named by
/// propertyName on item,
/// or a null reference if
/// exceptionThrownIfNoMatch is false and
/// propertyName does not name a property on
/// item.
/// </returns>
private static object GetNamedPropertyValue(
ICustomTypeDescriptor item,
string propertyName,
bool usesCaseSensitivePropertyNameMatch,
bool exceptionThrownIfNoMatch)
{
PropertyDescriptor descriptor;
StringComparison comparisonType;
if (item == null)
{
throw new ArgumentNullException("item");
}
if (string.IsNullOrEmpty("propertyName"))
{
throw new ArgumentException(
"propertyName is a null reference or empty string.",
"propertyName");
}
if (usesCaseSensitivePropertyNameMatch)
{
comparisonType = StringComparison.CurrentCulture;
}
else
{
comparisonType = StringComparison.CurrentCultureIgnoreCase;
}
descriptor = default(PropertyDescriptor);
foreach (PropertyDescriptor pd in item.GetProperties())
{
if (string.Equals(propertyName, pd.Name, comparisonType))
{
descriptor = pd;
break;
}
}
if (descriptor == default(PropertyDescriptor))
{
if (exceptionThrownIfNoMatch)
{
throw new ArgumentException(
"propertyName does not name a property on item.",
"propertyName");
}
else
{
return null;
}
}
else
{
return descriptor.GetValue(item);
}
}
开发者ID:smartpcr,项目名称:azure-iot-remote-monitoring,代码行数:85,代码来源:ReflectionHelper.cs
示例20: DataItemTypeDescriptor
internal DataItemTypeDescriptor( ICustomTypeDescriptor parent, Type objectType )
: base( parent )
{
if( parent == null )
throw new ArgumentNullException( "parent" );
m_targetType = objectType;
m_descriptorType = parent.GetType();
}
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:9,代码来源:DataItemTypeDescriptor.cs
注:本文中的ICustomTypeDescriptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论