Пример #1
0
        public SqlStatement(SqlParameterClause sqlParameterClause, SqlSelectClause sqlSelectClause, Type type)
        {
            this.m_SqlParameterClause = sqlParameterClause;
            this.m_SqlSelectClause = sqlSelectClause;

            this.m_SqlFromClause = new SqlFromClause(type);
            this.m_SqlWhereClause = new SqlWhereClause(type);
            this.m_SqlForXMLClause = new SqlForXMLClause(type);
        }
Пример #2
0
        public SqlStatement(SqlParameterClause sqlParameterClause, SqlSelectClause sqlSelectClause, Type type)
        {
            this.m_SqlParameterClause = sqlParameterClause;
            this.m_SqlSelectClause    = sqlSelectClause;

            this.m_SqlFromClause   = new SqlFromClause(type);
            this.m_SqlWhereClause  = new SqlWhereClause(type);
            this.m_SqlForXMLClause = new SqlForXMLClause(type);
        }
Пример #3
0
        public SqlCommand Build()
        {
            SqlCommand cmd = new SqlCommand();
            PersistentClass persistentClassAttribute = (PersistentClass)this.m_Type.GetCustomAttributes(typeof(PersistentClass), false).Single();

            PropertyInfo primaryKeyPropertyInfo = this.m_Type.GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(PersistentPrimaryKeyProperty))).Single();
            StringPropertyBridge primaryKeyPropertyBridge = new StringPropertyBridge(primaryKeyPropertyInfo, this.m_PrimaryKeyValue);
            primaryKeyPropertyBridge.SetSqlParameter(cmd);

            SqlSelectClause sqlSelect = new SqlSelectClause(this.m_Type);

            SqlParameterClause sqlParameterStatement = new SqlParameterClause(this.m_Type, this.m_PrimaryKeyValue);
            SqlStatement sqlStatement = new SqlStatement(sqlParameterStatement, sqlSelect, this.m_Type);

            cmd.CommandText = sqlStatement.ToString();
            return cmd;
        }
Пример #4
0
        public SqlCommand Build()
        {
            SqlCommand      cmd = new SqlCommand();
            PersistentClass persistentClassAttribute = (PersistentClass)this.m_Type.GetCustomAttributes(typeof(PersistentClass), false).Single();

            PropertyInfo         primaryKeyPropertyInfo   = this.m_Type.GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(PersistentPrimaryKeyProperty))).Single();
            StringPropertyBridge primaryKeyPropertyBridge = new StringPropertyBridge(primaryKeyPropertyInfo, this.m_PrimaryKeyValue);

            primaryKeyPropertyBridge.SetSqlParameter(cmd);

            SqlSelectClause sqlSelect = new SqlSelectClause(this.m_Type);

            SqlParameterClause sqlParameterStatement = new SqlParameterClause(this.m_Type, this.m_PrimaryKeyValue);
            SqlStatement       sqlStatement          = new SqlStatement(sqlParameterStatement, sqlSelect, this.m_Type);

            cmd.CommandText = sqlStatement.ToString();
            return(cmd);
        }