示例#1
0
 public BusinessDocLayerModel Remove(BusinessDocModel dm)
 {
     m_Docs.Remove(dm);
       dm.Parent = null;
       return this;
 }
示例#2
0
 public BusinessDocLayerModel Add(BusinessDocModel dm)
 {
     m_Docs.Add(dm);
       dm.Parent = this;
       return this;
 }
示例#3
0
 public BusinessDocModel NewDocument(string docName, DataEntityModel de)
 {
     BusinessDocModel dm = new BusinessDocModel(docName, de);
       Add(dm);
       dm.Parent = this;
       return dm;
 }
示例#4
0
 public int Add(BusinessDocModel dModel)
 {
     foreach (BusinessDocModel model in m_Items)
       {
     if (model.Name.ToLower().Equals(dModel.Name.ToLower()))
     {
       throw new ArgumentException("There is already a BusinessDocModel item in the container with the same name.");
     }
       }
       return m_Items.Add(dModel);
 }
示例#5
0
 public void Remove(BusinessDocModel dModel)
 {
     m_Items.Remove(dModel);
 }
示例#6
0
 public static string GetBaseDocumentFileName(BusinessDocModel bd)
 {
     return string.Format(@"\BaseDocuments\{0}Base.cs", bd.Name);
 }
示例#7
0
 public static string GetSnippetDocumentFileName(BusinessDocModel bd)
 {
     return string.Format(@"\Documents\{0}.cs", bd.Name);
 }
示例#8
0
 public static string GetOpName(DocOperationType type, BusinessDocModel doc)
 {
     return (type + doc.Name);
 }
示例#9
0
 // Methods
 public DocumentRelationModel(AssocModel assoc, BusinessDocModel doc)
 {
     m_Assoc = assoc;
       m_Document = doc;
 }
示例#10
0
 // Methods
 public DocumentOperation(DocOperationType type, BusinessDocModel doc)
 {
     m_Type = type;
       m_Doc = doc;
       base.m_DataLayer = doc.RootEntity.Parent;
 }
示例#11
0
 public DataEntityModel NewTable(string tableName)
 {
     DataEntityModel de = new DataEntityModel(tableName);
       de.MappingName = NormalizeTableName(tableName);
       Add(de);
       BusinessDocModel dm = new BusinessDocModel(GetDocumentName(de), de);
       base.Parent.BusinessDocsLayer.Add(dm);
       return de;
 }
示例#12
0
 public void GenerateCompoundDocument(CSharpFile docFile, BusinessDocModel bd)
 {
     docFile.Description = string.Format("Base business document class for '{0}' entity.", bd.Name);
       docFile.Usings.Add("System.Xml");
       docFile.Usings.Add("System.IO");
       docFile.Usings.Add("System.Data");
       docFile.Usings.Add("System.Data.SqlClient");
       docFile.Usings.Add("Grepton.Runtime");
       docFile.Usings.Add("Grepton.Runtime.DBTypes");
       docFile.Usings.Add("Grepton.Runtime.BusinessHosting");
       CSharpTypeDef typeDef = new CSharpTypeDef();
       docFile.InnerTypes.Add(typeDef);
       typeDef.Comment.Summary = docFile.Description;
       typeDef.HeaderLine = string.Format("public class {0}Base: {1}", bd.Name, bd.RootEntity.MappingName);
       typeDef.Attributes.Add("Serializable");
       GenerateSnippetConstructors(typeDef, bd.RootEntity, string.Format("{0}Base", bd.Name), bd.RootEntity.MappingName);
       foreach (DocumentRelationModel model in bd.ParentRelations)
       {
     CSharpFieldDef def2 = new CSharpFieldDef();
     typeDef.Fields.Add(def2);
     string str = model.Document.IsSimple ? model.Document.RootEntity.MappingName : model.Document.Name;
     string parentRole = model.Association.ParentRole;
     def2.CommentLine = string.Format("Parent document by '{0}'.", parentRole);
     def2.DefLine = string.Format("private {0} m_{1} = null;", str, parentRole);
     CSharpPropertyDef def3 = new CSharpPropertyDef();
     typeDef.Properties.Add(def3);
     def3.Comment.Summary = string.Format("Parent document by '{0}'", parentRole);
     def3.HeaderLine = string.Format("public {0} {1}", str, parentRole);
     def3.GetWriter.WriteLine(string.Format("return m_{0};", parentRole));
     def3.SetWriter.WriteLine(string.Format("m_{0} = value;", parentRole));
       }
       foreach (DocumentRelationModel model2 in bd.ChildRelations)
       {
     CSharpFieldDef def4 = new CSharpFieldDef();
     typeDef.Fields.Add(def4);
     string str3 = model2.Document.IsSimple ? model2.Document.RootEntity.MappingName : model2.Document.Name;
     string childRole = model2.Association.ChildRole;
     def4.CommentLine = string.Format("Child container by '{0}'.", childRole);
     def4.DefLine = string.Format("private {0}Container m_{1} = new {0}Container();", str3, childRole);
     CSharpPropertyDef def5 = new CSharpPropertyDef();
     typeDef.Properties.Add(def5);
     def5.Comment.Summary = string.Format("Child container by '{0}'", childRole);
     def5.HeaderLine = string.Format("public {0}Container {1}", str3, childRole);
     def5.GetWriter.WriteLine(string.Format("return m_{0};", childRole));
     def5.SetWriter.WriteLine(string.Format("m_{0} = value;", childRole));
       }
       GenerateContainerClass(docFile, bd.RootEntity, bd.Name, string.Format("{0}ContainerBase", bd.Name),                             "DocumentContainer");
 }
示例#13
0
 public void AddParent(string assocName, BusinessDocModel parentDoc)
 {
     if (parentDoc == null)
       {
     throw new ArgumentException("The parent document must be specified.");
       }
       if (parentDoc == this)
       {
     throw new ArgumentException("The document cannot be its own parent.");
       }
       AssocModel assoc = parentDoc.RootEntity.ParentAssocs[assocName];
       if (assoc == null)
       {
     throw new ArgumentException("The parent association is not a real parent.");
       }
       if (assoc.Child != RootEntity)
       {
     throw new ArgumentException("The parent association is not related to the specified parent document.");
       }
       ParentRelations.Add(new DocumentRelationModel(assoc, parentDoc));
 }
示例#14
0
 public void AddChild(string assocName, BusinessDocModel childDoc)
 {
     if (childDoc == null)
       {
     throw new ArgumentException("The child document must be specified.");
       }
       if (childDoc == this)
       {
     throw new ArgumentException("The document cannot be its own child.");
       }
       AssocModel assoc = RootEntity.ParentAssocs[assocName];
       if (assoc == null)
       {
     throw new ArgumentException("The child association is not a real child.");
       }
       if (assoc.Child != childDoc.RootEntity)
       {
     throw new ArgumentException("The child association is not related to the specified child document.");
       }
       ChildRelations.Add(new DocumentRelationModel(assoc, childDoc));
 }