private void Initialize(MethodGenerateOption option) { this.mOption = option; this.mCmd = new CodeVariableDeclarationStatement(this.mOption.CommandName, "cmd"); this.mSql = new CodeVariableDeclarationStatement(typeof(string), "sqlStr"); this.mDr = new CodeVariableDeclarationStatement(this.mOption.DataReaderName, "dr"); this.MemberMethods = new List <CodeMemberMethod>(); }
public void CreateMethod(MethodGenerateOption option) { this.Initialize(option); switch (option.MethodType) { default: case MethodType.Select: this.CreateSelect(); break; case MethodType.Insert: this.CreateInset(); break; case MethodType.Update: this.CreateUpdate(); break; } }
public void MethodContent(DataTable dt, MethodType methodType, bool enableDataObjectMethod) { MethodGenerator mg; MethodGenerateOption option = new MethodGenerateOption { CommandName = this.m_Option.CommandName, DataBaseType = this.DataBaseType, DataReaderName = this.m_Option.DataReaderName, DataTable = dt, KeyColunmNames = this.m_keyColumnNames, SchemaKeyName = this.m_Option.SchemaKeyName, TableName = this.m_Option.TableName, MethodType = methodType }; mg = new MethodGenerator(); mg.CreateMethod(option); this.m_MemberMethods = mg.MemberMethods; }