예제 #1
0
        public static DBSuit CreateSuit(Type connectionType, Type commandType, Type adapterType)
        {
            DBSuit suit = new DBSuit();

            suit.Conection = Activator.CreateInstance(connectionType) as IDbConnection;
            suit.Command   = Activator.CreateInstance(commandType) as IDbCommand;
            suit.Adapter   = Activator.CreateInstance(adapterType) as IDbDataAdapter;
            return(suit);
        }
예제 #2
0
        public static DBSuit CreateSuit <Connection, Command, Adapter>(IDbConnection connction, IDbCommand command)
            where Connection : IDbConnection
            where Command : IDbCommand
            where Adapter : IDbDataAdapter
        {
            DBSuit suit = new DBSuit();

            if (connction == null)
            {
                connction = Activator.CreateInstance <IDbConnection>();
            }
            if (command == null)
            {
                command = Activator.CreateInstance <IDbCommand>();
            }
            suit.Conection = connction;
            suit.Command   = command;
            suit.Adapter   = Activator.CreateInstance <IDbDataAdapter>();
            return(suit);
        }