Ejemplo n.º 1
0
        /// <summary>
        /// Saves the specified entity using the specified data provider.
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="provider"></param>
        /// <param name="transactionContext"></param>
        /// <returns></returns>
        public static DataModel <TEntity> Save(TEntity entity, DataProviderBase provider, DbTransaction transactionContext)
        {
            var model = new DataModel <TEntity>(entity);

            provider.SaveModel(model, transactionContext);
            return(model);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves the specified entity using the application default provider.
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="provider"></param>
        public static DataModel <TEntity> Save(TEntity entity, DataProviderBase provider)
        {
            var model = new DataModel <TEntity>(entity);

            provider.SaveModel(model);
            return(model);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Saves the specified entity using the specified data provider.
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="provider"></param>
        /// <param name="deep"></param>
        /// <param name="transactionContext"></param>
        /// <returns></returns>
        public static DataModel <TEntity> Save(TEntity entity, DataProviderBase provider, bool deep, DbTransaction transactionContext)
        {
            var model = new DataModel <TEntity>(entity);

            if (deep)
            {
                provider.DeepSaveModel(model, transactionContext);
            }
            else
            {
                provider.SaveModel(model, transactionContext);
            }
            return(model);
        }