Ejemplo n.º 1
0
        private static Type GetModelType(CachedModelMetadata <TPrototypeCache> prototype)
        {
            if (prototype == null)
            {
                throw Error.ArgumentNull("prototype");
            }

            return(prototype.ModelType);
        }
Ejemplo n.º 2
0
        private static string GetPropertyName(CachedModelMetadata <TPrototypeCache> prototype)
        {
            if (prototype == null)
            {
                throw Error.ArgumentNull("prototype");
            }

            return(prototype.PropertyName);
        }
Ejemplo n.º 3
0
        private static ModelMetadataProvider GetProvider(CachedModelMetadata <TPrototypeCache> prototype)
        {
            if (prototype == null)
            {
                throw Error.ArgumentNull("prototype");
            }

            return(prototype.Provider);
        }
Ejemplo n.º 4
0
        /// <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;
        }