本文整理汇总了C#中ICustomTypeDescriptor类的典型用法代码示例。如果您正苦于以下问题:C# ICustomTypeDescriptor类的具体用法?C# ICustomTypeDescriptor怎么用?C# ICustomTypeDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICustomTypeDescriptor类属于命名空间,在下文中一共展示了ICustomTypeDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ModelTypeDescriptor
public ModelTypeDescriptor(ICustomTypeDescriptor parent, object instance, IList<ModelProperty> properties)
: base(parent)
{
modelPropertyDescriptors = properties
.Select(p => new ModelPropertyDescriptor(p))
.ToArray();
}
示例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;
}
}
}
}
示例3: DomainTypeDescriptor
public DomainTypeDescriptor(Type entityType, ICustomTypeDescriptor parent, bool keyIsEditable, HashSet<string> foreignKeyMembers)
: base(parent)
{
this._entityType = entityType;
this._keyIsEditable = keyIsEditable;
this._foreignKeyMembers = foreignKeyMembers;
}
示例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;
}
示例5: GetTypeDescriptor
internal static ICustomTypeDescriptor GetTypeDescriptor( Type objectType, ICustomTypeDescriptor descriptor )
{
if( descriptor == null )
return null;
return new DataItemTypeDescriptor( descriptor, objectType );
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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);
}