Example #1
0
        public override DomainServiceDescriptionProvider CreateProvider(
            Type domainServiceType, DomainServiceDescriptionProvider parent)
        {
            var chainedProvider = CreateProviderChain(domainServiceType);

            return(new FluentTypeDescriptionProvider(domainServiceType, parent, metaDataConfiguration, chainedProvider ?? parent));
        }
 public FluentTypeDescriptionProvider(Type domainServiceType, DomainServiceDescriptionProvider parent, IFluentMetadataConfiguration metaDataConfiguration, DomainServiceDescriptionProvider chainedProvider)
     : base(domainServiceType, parent)
 {
     container = new MetadataContainer(chainedProvider);
     metaDataConfiguration.OnTypeCreation(container);
     container.ResolveInheritedMetadata();
 }
 /// <summary>
 /// Constructor that accepts a metadata context to use when generating custom type descriptors
 /// </summary>
 /// <param name="existingProvider">The parent TDP instance</param>
 /// <param name="domainServiceType">The DomainService Type exposing the entity Types this provider will be registered for</param>
 /// <param name="unitOfWorkType">The DataContext Type that exposes the Types this provider will be registered for</param>
 public LightSpeedTypeDescriptionProvider(DomainServiceDescriptionProvider existingProvider, Type domainServiceType, Type unitOfWorkType)
     : base(domainServiceType,existingProvider)
 {
     lock (_tdpContextMap)
     {
         if (!_tdpContextMap.TryGetValue(domainServiceType, out this._typeDescriptionContext))
         {
             this._typeDescriptionContext = new LightSpeedTypeDescriptionContext(unitOfWorkType);
             _tdpContextMap.Add(domainServiceType, _typeDescriptionContext);
         }
     }
 }
        /// <summary>
        /// This method creates an instance of the <see cref="TypeDescriptionProvider"/>.
        /// </summary>
        /// <param name="existingProvider">The existing <see cref="TypeDescriptionProvider"/> for the Type the returned
        /// provider will be registered for.</param>
        /// <param name="domainServiceType">The <see cref="DomainService"/> Type metadata is being provided for.</param>
        /// <returns>The <see cref="TypeDescriptionProvider"/> instance.</returns>
        public override DomainServiceDescriptionProvider CreateProvider(Type domainServiceType, DomainServiceDescriptionProvider existingProvider)
        {
            if (domainServiceType == null)
            {
                throw new ArgumentNullException("domainServiceType");
            }

            if (this._unitOfWorkType == null)
            {
                this._unitOfWorkType = GetUnitOfWorkType(domainServiceType);
            }

            return new LightSpeedTypeDescriptionProvider(existingProvider, domainServiceType, this._unitOfWorkType);
        }
        /// <summary>
        /// This method creates an instance of the <see cref="TypeDescriptionProvider"/>.
        /// </summary>
        /// <param name="domainServiceType">The <see cref="DomainService"/> Type to create a description provider for.</param>
        /// <param name="parent">The existing parent description provider.</param>
        /// <returns>The description provider.</returns>
        public override DomainServiceDescriptionProvider CreateProvider(Type domainServiceType, DomainServiceDescriptionProvider parent)
        {
            if (domainServiceType == null)
            {
                throw new ArgumentNullException("domainServiceType");
            }

            if (this._dbContextType == null)
            {
                this._dbContextType = GetContextType(domainServiceType);
            }

            if (!typeof(DbContext).IsAssignableFrom(this._dbContextType))
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
                    DbResource.InvalidDbDomainServiceDescriptionProviderSpecification,
                    this._dbContextType));
            }

            return new LinqToEntitiesDomainServiceDescriptionProvider(domainServiceType, this._dbContextType, parent);
        }
        /// <summary>
        /// This method creates an instance of the <see cref="LinqToSqlDomainServiceDescriptionProvider"/>.
        /// </summary>
        /// <param name="domainServiceType">The <see cref="DomainService"/> Type to create a description provider for.</param>
        /// <param name="parent">The existing parent description provider.</param>
        /// <returns>The description provider.</returns>
        public override DomainServiceDescriptionProvider CreateProvider(Type domainServiceType, DomainServiceDescriptionProvider parent)
        {
            if (domainServiceType == null)
            {
                throw new ArgumentNullException("domainServiceType");
            }

            if (this._dataContextType == null)
            {
                this._dataContextType = GetContextType(domainServiceType);
            }

            if (!typeof(DataContext).IsAssignableFrom(this._dataContextType))
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
                                                                  Resource.InvalidLinqToSqlDomainServiceDescriptionProviderSpecification,
                                                                  this._dataContextType));
            }

            return(new LinqToSqlDomainServiceDescriptionProvider(domainServiceType, this._dataContextType, parent));
        }
 public Mock_DomainServiceDescriptionProvider(Type domainServiceType, DomainServiceDescriptionProvider parent)
     : base(domainServiceType, parent)
 {
     this._domainServiceType   = domainServiceType;
     this._descriptionProvider = parent;
 }
 public LinqToEntitiesDomainServiceDescriptionProvider(Type domainServiceType, Type contextType, DomainServiceDescriptionProvider parent)
     : base(domainServiceType, parent)
 {
     lock (tdpContextMap)
     {
         if (!tdpContextMap.TryGetValue(contextType, out this._typeDescriptionContext))
         {
             // create and cache a context for this provider type
             this._typeDescriptionContext = new LinqToEntitiesTypeDescriptionContext(contextType);
             tdpContextMap.Add(contextType, this._typeDescriptionContext);
         }
     }
 }
 public NHibernateTypeDescriptionProvider(Type domainServiceType, DomainServiceDescriptionProvider parent, Configuration configuration)
     : base(domainServiceType, parent)
 {
     _domainServiceType = domainServiceType;
     _nhConfiguration   = configuration;
 }
 public GeneratedMetadataProvider(Type domainServiceType, DomainServiceDescriptionProvider parent)
     : base(domainServiceType, parent)
 {
 }
Example #11
0
 internal MetadataContainer(DomainServiceDescriptionProvider provider)
 {
     this.provider = provider;
 }
        public override DomainServiceDescriptionProvider CreateProvider(Type domainServiceType, DomainServiceDescriptionProvider parent)
        {
            string        currentDir = AppDomain.CurrentDomain.BaseDirectory;
            Configuration cfg        = null;

            try
            {
                cfg = new Configuration();
                cfg.Configure(_nHibernateConfigurationPath);
                cfg.AddDirectory(new DirectoryInfo(currentDir));
            }
            catch
            {
                throw;
            }

            return(new NHibernateTypeDescriptionProvider(domainServiceType, parent, cfg));
        }