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(); }
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(); }
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 :)"); }
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(); }
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 :)"); }