コード例 #1
0
        internal HarshEntityMetadataContentType(HarshEntityMetadataRepository repository, TypeInfo entityTypeInfo)
            : base(repository, entityTypeInfo)
        {
            ContentTypeAttribute = ObjectTypeInfo.GetCustomAttribute <ContentTypeAttribute>();

            if (ContentTypeAttribute == null)
            {
                throw Logger.Fatal.ArgumentFormat(
                          nameof(entityTypeInfo),
                          SR.HarshEntityMetadataContentType_NoContentTypeAttribute,
                          entityTypeInfo.FullName
                          );
            }

            ContentTypeId = new ContentTypeIdBuilder(ObjectTypeInfo).ToString();
        }
コード例 #2
0
        internal HarshEntityMetadataContentType(HarshEntityMetadataRepository repository, TypeInfo entityTypeInfo)
            : base(repository, entityTypeInfo)
        {
            ContentTypeAttribute = ObjectTypeInfo.GetCustomAttribute<ContentTypeAttribute>();

            if (ContentTypeAttribute == null)
            {
                throw Logger.Fatal.ArgumentFormat(
                    nameof(entityTypeInfo),
                    SR.HarshEntityMetadataContentType_NoContentTypeAttribute,
                    entityTypeInfo.FullName
                );
            }

            ContentTypeId = new ContentTypeIdBuilder(ObjectTypeInfo).ToString();
        }
コード例 #3
0
        internal static HarshEntityMetadata Create(HarshEntityMetadataRepository repository, TypeInfo typeInfo)
        {
            if (repository == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(repository));
            }

            if (typeInfo == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(typeInfo));
            }

            if (typeInfo.IsDefined(typeof(ContentTypeAttribute), inherit: false))
            {
                return(new HarshEntityMetadataContentType(repository, typeInfo));
            }

            throw new NotImplementedException("TODO: more entity types to come :)");
        }
コード例 #4
0
        internal HarshEntityMetadata(HarshEntityMetadataRepository repository, TypeInfo entityTypeInfo)
            : base(entityTypeInfo)
        {
            if (repository == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(repository));
            }

            if (!HarshEntityTypeInfo.IsAssignableFrom(ObjectTypeInfo))
            {
                throw Logger.Fatal.ArgumentTypeNotAssignableTo(
                          nameof(entityTypeInfo),
                          entityTypeInfo.AsType(),
                          HarshEntityTypeInfo.AsType()
                          );
            }

            Repository = repository;

            GetBaseEntity();
            CreateDeclaredFields();
        }
コード例 #5
0
        internal HarshEntityMetadata(HarshEntityMetadataRepository repository, TypeInfo entityTypeInfo)
            : base(entityTypeInfo)
        {
            if (repository == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(repository));
            }

            if (!HarshEntityTypeInfo.IsAssignableFrom(ObjectTypeInfo))
            {
                throw Logger.Fatal.ArgumentTypeNotAssignableTo(
                    nameof(entityTypeInfo),
                    entityTypeInfo.AsType(),
                    HarshEntityTypeInfo.AsType()
                );
            }

            Repository = repository;

            GetBaseEntity();
            CreateDeclaredFields();
        }
コード例 #6
0
        internal static HarshEntityMetadata Create(HarshEntityMetadataRepository repository, TypeInfo typeInfo)
        {
            if (repository == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(repository));
            }

            if (typeInfo == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(typeInfo));
            }

            if (typeInfo.IsDefined(typeof(ContentTypeAttribute), inherit: false))
            {
                return new HarshEntityMetadataContentType(repository, typeInfo);
            }

            throw new NotImplementedException("TODO: more entity types to come :)");
        }