private static Type GetModelType(CachedModelMetadata <TPrototypeCache> prototype) { if (prototype == null) { throw Error.ArgumentNull("prototype"); } return(prototype.ModelType); }
private static string GetPropertyName(CachedModelMetadata <TPrototypeCache> prototype) { if (prototype == null) { throw Error.ArgumentNull("prototype"); } return(prototype.PropertyName); }
private static ModelMetadataProvider GetProvider(CachedModelMetadata <TPrototypeCache> prototype) { if (prototype == null) { throw Error.ArgumentNull("prototype"); } return(prototype.Provider); }
/// <summary> /// Initializes a new instance of the <see cref="CachedDataAnnotationsMetadataAttributes"/> class. /// </summary> /// <param name="prototype">The prototype.</param> /// <param name="modelAccessor">The model accessor.</param> /// <remarks>Constructor for creating real instances of the metadata class based on a prototype.</remarks> protected CachedModelMetadata(CachedModelMetadata <TPrototypeCache> prototype, Func <object> modelAccessor) : base(GetProvider(prototype), GetContainerType(prototype), modelAccessor, GetModelType(prototype), GetPropertyName(prototype)) { if (prototype == null) { throw Error.ArgumentNull("prototype"); } this.PrototypeCache = prototype.PrototypeCache; this.isComplexType = prototype.IsComplexType; this.isComplexTypeComputed = true; }