复合c1静态数据类型接口实现

时间:2014-07-18 15:16:11

标签: inheritance types interface static

我正在通过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; }
}

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

约翰, 如果你想创建继承类型..你的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。现在你可以这样做:

public interface IProduct:IPublishControlled,ILocalizedControlled,IBase