コード例 #1
0
        /// <summary>
        /// Registers a singleton as a part of the model and returns an object that can be used to configure the singleton.
        /// This method can be called multiple times for the same type to perform multiple lines of configuration.
        /// </summary>
        /// <typeparam name="TEntityType">The entity type of the singleton.</typeparam>
        /// <param name="name">The name of the singleton.</param>
        /// <returns>The configuration object for the specified singleton.</returns>
        public SingletonConfiguration <TEntityType> Singleton <TEntityType>(string name) where TEntityType : class
        {
            EntityTypeConfiguration entity = this.AddEntityType(typeof(TEntityType));

            return(new SingletonConfiguration <TEntityType>(this, this.AddSingleton(name, entity)));
        }
コード例 #2
0
        /// <summary>
        /// Registers an entity set as a part of the model and returns an object that can be used to configure the entity set.
        /// This method can be called multiple times for the same type to perform multiple lines of configuration.
        /// </summary>
        /// <typeparam name="TEntityType">The entity type of the entity set.</typeparam>
        /// <param name="name">The name of the entity set.</param>
        /// <returns>The configuration object for the specified entity set.</returns>
        public EntitySetConfiguration <TEntityType> EntitySet <TEntityType>(string name) where TEntityType : class
        {
            EntityTypeConfiguration entity = this.AddEntityType(typeof(TEntityType));

            return(new EntitySetConfiguration <TEntityType>(this, this.AddEntitySet(name, entity)));
        }