예제 #1
0
        private DictionaryAtom ExecuteProcedure(DictionaryAtom dbCommand)
        {
            Validation.IsNotNull(dbCommand, "dbCommand");

            var dbSchema      = dbCommand.GetString("schema");
            var dbCommandName = dbCommand.GetString("commandName");
            var proc          = GetProcedure(dbSchema, dbCommandName);

            if (proc == null)
            {
                throw new ObjectNotFoundException(string.Format(Resources.ERR_DB_PROC_NOT_FOUND, dbSchema, dbCommandName));
            }

            var dbParameterSet = dbCommand.GetAtom <DictionaryAtom>("parameters");

            var executor  = new ProcedureExecutor <SqlCommand>(_connection, _log, proc);
            var result    = executor.ExecuteQuery(dbParameterSet?.ToDictionary());
            var dataTable = result.Item2.CastAs <DataTable>();

            var resultSet = new DictionaryAtom();

            resultSet.Set("Results", dataTable.ToListAtom());
            resultSet.Set("Schema", dbSchema);
            resultSet.Set("CommandName", dbCommandName);

            dataTable.Dispose();
            return(resultSet);
        }
예제 #2
0
 public void OnLoad(DictionaryAtom data)
 {
     Username   = data.GetString("Username");
     ID         = data.GetInt("UserID");
     PreHashId  = data.GetInt("PreHashID");
     PostHashId = data.GetInt("PostHashID");
 }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="initAtom"></param>
        public void OnInit(DictionaryAtom initAtom)
        {
            Validation.IsNotNull(initAtom, "initAtom");

            _numberVMs = initAtom.GetInt("NumberLuaVMs");
            Validation.Validate <ArgumentOutOfRangeException>(_numberVMs >= 1);

            _dataPath = initAtom.GetString("DataPath");

            Log.DebugFormat("{0} asked to initialize {1} LuaVMs.", GetType(), _numberVMs);

            var kernel = (IKernel)initAtom.GetObject("Ninject.Kernel");

            EventManager.RegisterListener(this, kernel.Get <IGame>(), typeof(OnGameInitialize), Instance_OnGameInitialize);
        }
예제 #4
0
        /// <summary>
        /// Do initialization that cannot be done at construction
        /// </summary>
        public void OnInit(DictionaryAtom args)
        {
            Validation.IsNotNull(args, "args");

            _connectionString = args.GetString("ConnectionString");
            Validation.IsNotNullOrEmpty(_connectionString, "_connectionString");

            _numberServers = args.GetInt("NumberDBServers");
            Validation.Validate <ArgumentOutOfRangeException>(_numberServers >= 1);
            _log.DebugFormat("{0} asked to spin up {1} database servers.", GetType(), _numberServers);

            InitDatabaseLoaders(args);
            _loaderArgs = args.GetAtom <ListAtom>("Loaders");

            _eventManager.RegisterListener(this, typeof(OnGameInitialize), Instance_OnGameInitialize);
        }