コード例 #1
0
 /// <summary>
 /// Protected constructor; the command is assumed to be a prototype
 /// that will be cloned on CreateCommand, and the cloned command will be executed.
 /// </summary>
 protected DbCommandDefinition(DbCommand prototype)
 {
     EntityUtil.CheckArgumentNull(prototype, "prototype");
     _prototype = prototype as ICloneable;
     if (null == _prototype)
     {
         throw EntityUtil.CannotCloneStoreProvider();
     }
 }
コード例 #2
0
        /// <summary>
        /// Internal factory method to create the default Command Definition object
        /// based on a prototype command. The prototype command is cloned
        /// before the protected constructor is invoked
        /// </summary>
        /// <param name="prototype">prototype DbCommand</param>
        /// <returns>the DbCommandDefinition</returns>
        internal static DbCommandDefinition CreateCommandDefinition(DbCommand prototype)
        {
            EntityUtil.CheckArgumentNull(prototype, "prototype");
            ICloneable cloneablePrototype = prototype as ICloneable;

            if (null == cloneablePrototype)
            {
                throw EntityUtil.CannotCloneStoreProvider();
            }
            DbCommand clonedPrototype = (DbCommand)(cloneablePrototype.Clone());

            return(new DbCommandDefinition(clonedPrototype));
        }