private void processCreation() { #if OLDCREATION Entity = Regex.Match(Query, @"^\s*create\s+(\w+)").Groups[1].Value; Type = Entity; var applyes = Regex.Matches(Query,@"(?<name>\w+)\s*=\s*'(?<value>[^']*)'"); var dict = new Dictionary<string, string>(); foreach (Match applye in applyes) { dict[applye.Groups["name"].Value] = applye.Groups["value"].Value; } create(dict); //Query = "from " + Entity + " where Id = " + CreatedObjId; PropertyBag["result"] = new object[] { CreatedObj }; #else Query = Query.replace(@"/\*[\s\S]+?\*/", ""); var createscriptxml = new BxlParser().Parse(this.Query,"main"); var transform = createscriptxml.Element("transform"); if(null!=transform) { transform.Remove(); var file = transform.attr("code")+".xslt"; var path = myapp.files.Resolve(file,true); if(path.noContent()) { throw new Exception("cannot find transform file "+file); } var xslt = new XslCompiledTransform(); xslt.Load(path,XsltSettings.TrustedXslt,new XmlUrlResolver()); var sw = new StringWriter(); var arglist = new XsltArgumentList(); arglist.AddParam("timestamp","",DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss")); xslt.Transform(createscriptxml.CreateReader(),arglist,sw); createscriptxml = XElement.Parse(sw.ToString()); } var creations = createscriptxml.Elements("create"); var result = new List<HqlResult>(); foreach (var creation in creations) { var tree = creation.attr("tree"); var subresult = new HqlResult(); subresult.Entity = creation.attr("id"); subresult.Items = new List<object>(); if (creation.Elements(subresult.Entity).Count() == 0) { creation.Add(new XElement(subresult.Entity)); } var items = creation.Descendants(subresult.Entity); foreach (var item in items) { var selfattributes = item.Attributes(); var parentattributes = item.Parent.Attributes().Where( x => null == selfattributes.FirstOrDefault(y => y.Name.LocalName == x.Name.LocalName)); var allattributes = selfattributes.Union(parentattributes).Where(x => x.Name.LocalName != "id").ToArray(); var dict = new Dictionary<string, string>(); foreach (var o in allattributes) { dict[o.Name.LocalName] = o.Value; } if(tree.hasContent() && item.Parent!=null && item.Parent.Name.LocalName!="create") { dict[tree] = item.Parent.attr("code"); } create(dict, subresult.Entity); subresult.Items.Add(this.CreatedObj); } var cols = new HqlColumnLoader().GetColumns(subresult.Entity, View); subresult.Columns = cols; result.Add(subresult); } PropertyBag["results"] = result; PropertyBag["multiple"] = true; #endif }