Ejemplo n.º 1
0
        public DbCache(TConnection connection, DecorateDbObjects decorator, String schema, String table, AddTileCommand atc, RemoveTileCommand rtc, FindTileCommand ftc)
        {
            Connection = connection;
            Schema     = schema;
            Table      = table;

            _decorator = decorator;

            if (atc != null)
            {
                _addTileCommand = atc(connection, decorator, schema, table);
            }

            if (rtc != null)
            {
                _removeTileCommand = rtc(connection, decorator, schema, table);
            }

            if (ftc == null)
            {
                ftc = BasicFindTileCommand;
            }

            _findTileCommand = ftc(connection, decorator, schema, table);

            _bank = new BankOfSelectTileCommands(_findTileCommand);

            if (Connection.State == ConnectionState.Open)
            {
                Connection.Close();
            }
        }
Ejemplo n.º 2
0
        public DbCache(SerializationInfo info, StreamingContext context)
        {
            Connection = (TConnection)info.GetValue("connection", typeof(TConnection));
            Schema     = info.GetString("schema");
            Table      = info.GetString("table");

            _addTileCommand    = (IDbCommand)info.GetValue("add", typeof(IDbCommand));
            _removeTileCommand = (IDbCommand)info.GetValue("remove", typeof(IDbCommand));
            _findTileCommand   = (IDbCommand)info.GetValue("find", typeof(IDbCommand));

            _bank = new BankOfSelectTileCommands(_findTileCommand);
        }