我正在通过C#创建数据类型。我希望有一个包含每个C#创建的数据类型所使用的属性的基本接口。但是当实现基本接口时,数据类型就从UI中消失了。我需要设置什么特殊属性才能实现基接口吗?
这是可行的:
[AutoUpdateble]
[KeyPropertyName("Id")]
[LabelPropertyName("Id")]
[ImmutableTypeId("{96071614-AC10-4741-8BEA-8D1720B4BBE9}")]
[DataScope(DataScopeIdentifier.PublicName)]
[DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]
[RelevantToUserType(UserType.Developer)]
[PublishProcessControllerType(typeof(GenericPublishProcessController))]
public interface IProduct : IPublishControlled, ILocalizedControlled
{
[StoreFieldType(PhysicalStoreFieldType.Guid)]
[ImmutableFieldId("{F728357F-CD1E-49F9-8EB7-09AB5317248E}")]
Guid Id { get; set; }
[StoreFieldType(PhysicalStoreFieldType.String, 249)]
[ImmutableFieldId("{9F551C4C-99BA-46C5-9BC5-9AE0A2EB00ED}")]
string Title { get; set; }
}如果我将下面的接口(IBase)添加到(IProduct),它不能工作
[KeyPropertyName("Id")]
[ImmutableTypeId("{DA2B4217-71BE-4225-8059-7E846D7EDA0D}")]
[DataScope(DataScopeIdentifier.PublicName)]
[DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]
[RelevantToUserType(UserType.Developer)]
[PublishProcessControllerType(typeof(GenericPublishProcessController))]
public interface IBase
{
[StoreFieldType(PhysicalStoreFieldType.Guid)]
[ImmutableFieldId("{66946660-5E2A-4B19-9FFF-B9861CFF9274}")]
Guid Id { get; set; }
[StoreFieldType(PhysicalStoreFieldType.Integer)]
[ImmutableFieldId("{40A9F106-B634-49B6-9157-BFCE232C362D}")]
int SortOrder { get; set; }
[StoreFieldType(PhysicalStoreFieldType.String, 249)]
[ImmutableFieldId("{72EBBE55-FB0D-496C-A316-0CD8765C10FC}")]
string Description { get; set; }
}请提供任何帮助,非常感谢。
发布于 2015-03-13 02:51:02
Johan,如果你想创建继承的types..your IBase,应该是这样的:
public interface IBase
{
[StoreFieldType(PhysicalStoreFieldType.Integer)]
[ImmutableFieldId("{40A9F106-B634-49B6-9157-BFCE232C362D}")]
int SortOrder { get; set; }
[StoreFieldType(PhysicalStoreFieldType.String, 249)]
[ImmutableFieldId("{72EBBE55-FB0D-496C-A316-0CD8765C10FC}")]
string Description { get; set; }
}所以我们杀死了接口属性和Id。现在你可以这样做了:
公共接口IProduct : IPublishControlled、ILocalizedControlled、IBase
https://stackoverflow.com/questions/24828434
复制相似问题