LoadSessionObject() публичный Метод

public LoadSessionObject ( IDataRecord record ) : void
record IDataRecord
Результат void
Пример #1
0
        public void LoadParameters()
        {
            SqlParameter sqlSessionParameter = new SqlParameter("@SessionId", GlymaSession.Session.Id);

            using (IDbConnectionAbstraction parametersDbConnection = GlymaSession.ConnectionFactory.CreateParametersDbConnection())
            {
                SqlCommand selectParametersFromId = new SqlCommand(SelectParametersFromSessionId, parametersDbConnection.Connection);
                selectParametersFromId.Parameters.Add(sqlSessionParameter);

                parametersDbConnection.Open();

                IDataReader parameters = selectParametersFromId.ExecuteReader();

                while (parameters.Read())
                {
                    MapParameter parameter = new MapParameter();

                    parameter.LoadSessionObject(parameters);

                    AddParameter(parameter);
                }

                parametersDbConnection.Close();
            }
        }
Пример #2
0
        public MapParameter this[Guid parameterId]
        {
            get
            {
                if (ParameterContainer.ContainsKey(parameterId))
                {
                    return(ParameterContainer[parameterId]);
                }
                else
                {
                    SqlParameter parameterIdSqlParameter = new SqlParameter("@ParameterId", parameterId);

                    using (IDbConnectionAbstraction parametersDbConnection = GlymaSession.ConnectionFactory.CreateParametersDbConnection())
                    {
                        SqlCommand getParameter = new SqlCommand("SELECT * FROM [Parameters] WHERE [ParameterUid] = @ParameterId;", parametersDbConnection.Connection);
                        getParameter.Parameters.Add(parameterIdSqlParameter);

                        parametersDbConnection.Open();

                        IDataReader parameters = getParameter.ExecuteReader();

                        MapParameter parameter = null;

                        while (parameters.Read())
                        {
                            parameter = new MapParameter();

                            parameter.LoadSessionObject(parameters);

                            AddParameter(parameter);
                        }

                        parametersDbConnection.Close();

                        return(parameter);
                    }
                }
            }
        }