Esempio n. 1
0
        private void BuildCommand(MySqlCommand cmd, Type typeToBuild, string primaryKeyValue)
        {
            PersistentClass      persistentClassAttribute = (PersistentClass)typeToBuild.GetCustomAttributes(typeof(PersistentClass), false).Single();
            PropertyInfo         primaryKeyPropertyInfo   = typeToBuild.GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(PersistentPrimaryKeyProperty))).Single();
            StringPropertyBridge primaryKeyPropertyBridge = new StringPropertyBridge(primaryKeyPropertyInfo, primaryKeyValue);

            primaryKeyPropertyBridge.SetSqlParameter(cmd);
            cmd.CommandText += "Select * from " + persistentClassAttribute.StorageName + " where " + primaryKeyPropertyInfo.Name + " = " + primaryKeyPropertyBridge.AtName + "; ";

            this.BuildPersistentChildCollectionCommands(typeToBuild, cmd);
        }
Esempio n. 2
0
        private void BuildCommand(SqlCommand cmd, Type typeToBuild, string primaryKeyValue)
        {
            PersistentClass persistentClassAttribute = (PersistentClass)typeToBuild.GetCustomAttributes(typeof(PersistentClass), false).Single();
            PropertyInfo primaryKeyPropertyInfo = typeToBuild.GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(PersistentPrimaryKeyProperty))).Single();
            StringPropertyBridge primaryKeyPropertyBridge = new StringPropertyBridge(primaryKeyPropertyInfo, primaryKeyValue);

            primaryKeyPropertyBridge.SetSqlParameter(cmd);
            cmd.CommandText += "Select * from " + persistentClassAttribute.StorageName + " where " + primaryKeyPropertyInfo.Name + " = " + primaryKeyPropertyBridge.AtName + "; ";

            this.BuildPersistentChildCollectionCommands(typeToBuild, cmd);
        }
Esempio n. 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;
        }
Esempio n. 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);
        }