public void GenerateServiceMethod(object outObj) { CSharpTypeDef def = outObj as CSharpTypeDef; CSharpMethodDef srvMethod = null; switch (m_Type) { case AssocOperationType.SelectBy: srvMethod = new CSharpServiceMethodDef(); GenerateSelectBy(srvMethod); break; case AssocOperationType.DeleteBy: srvMethod = new CSharpServiceTranMethodDef(); GenerateDeleteBy(srvMethod); break; } def.Methods.Add(srvMethod); }
public void GenerateServiceMethod(object outObj) { CSharpTypeDef def = outObj as CSharpTypeDef; CSharpMethodDef srvMethod = null; switch (m_Type) { case TableOperationType.Select: srvMethod = new CSharpServiceMethodDef(); GenerateSelect(srvMethod); break; case TableOperationType.Insert: srvMethod = new CSharpServiceTranMethodDef(); GenerateInsert(srvMethod); break; case TableOperationType.Update: srvMethod = new CSharpServiceTranMethodDef(); GenerateUpdate(srvMethod); break; case TableOperationType.Delete: srvMethod = new CSharpServiceTranMethodDef(); GenerateDelete(srvMethod); break; case TableOperationType.SelectAll: srvMethod = new CSharpServiceMethodDef(); GenerateSelectAll(srvMethod); break; case TableOperationType.SelectDispsetAll: srvMethod = new CSharpServiceMethodDef(); GenerateSelectDispsetAll(srvMethod); break; } def.Methods.Add(srvMethod); }
public void GenerateServiceMethod(object outObj) { CSharpTypeDef def = outObj as CSharpTypeDef; CSharpServiceMethodDef method = new CSharpServiceMethodDef(); method.Comment.Summary = string.Format("Get the {0} child records by '{1}'.", m_RightAssoc.Parent.Name, m_LeftAssoc.Name); method.HeaderLine = string.Format("public virtual {0}Container {0}AssignBy{1}", m_RightAssoc.Parent.Name, m_LeftAssoc.Name); GenerationHelper.AddMethodParams(method, m_LeftAssoc.Parent.PKFields); TextWriter tw = method.Writer; tw.WriteLine("{0}Container result;", m_RightAssoc.Parent.Name); tw.Write("DataSet entitySet = m_DataContext.{0}(", Sql2000SpGenerator.GetAssignmentSpName(m_LeftAssoc)); GenerationHelper.EnumerateParams(tw, m_LeftAssoc.Parent.PKFields, "{0}Val"); tw.WriteLine(");"); tw.WriteLine("result = new {0}Container(entitySet.Tables[0]);", m_RightAssoc.Parent.Name); def.Methods.Add(method); }