public override void DoSecondPass(IDictionary <string, PersistentClass> persistentClasses) { if (value is ManyToOne) { ManyToOne manyToOne = (ManyToOne)value; PersistentClass @ref; persistentClasses.TryGetValue(manyToOne.ReferencedEntityName, out @ref); if (@ref == null) { throw new AnnotationException( "@OneToOne or @ManyToOne on " + StringHelper.Qualify(entityClassName, path) + " references an unknown entity: " + manyToOne.ReferencedEntityName); } BinderHelper.CreateSyntheticPropertyReference(columns, @ref, null, manyToOne, false, mappings); TableBinder.BindFk(@ref, null, columns, manyToOne, unique, mappings); //HbmBinder does this only when property-ref != null, but IMO, it makes sense event if it is null if (!manyToOne.IsIgnoreNotFound) { manyToOne.CreatePropertyRefConstraints(persistentClasses); } } else if (value is OneToOne) { value.CreateForeignKey(); } else { throw new AssertionFailure("FkSecondPass for a wrong value type: " + value.GetType().Name); } }
internal void RenderNodes() { var parameters = new WordTemplateParameters(this.entity, this.culture, this.dicTokenColumn !, this.table !.Rows, template, model); foreach (var part in document.AllParts().Where(p => p.RootElement != null)) { var root = part.RootElement !; var baseNodes = root.Descendants <BaseNode>().ToList(); //eager foreach (var node in baseNodes) { node.RenderNode(parameters); } TableBinder.ProcessTables(part, parameters); foreach (var item in root.Descendants <D.Charts.ExternalData>().ToList()) { item.Remove(); } } foreach (var item in document.AllParts().OfType <EmbeddedPackagePart>().ToList()) { foreach (var p in item.GetParentParts().ToList()) { p.DeletePart(item); } } }
public void ParseDocument() { foreach (var part in document.AllParts().Where(p => p.RootElement != null)) { foreach (var item in part.RootElement !.Descendants()) { if (item is W.Paragraph wp) { ReplaceRuns(wp, new WordprocessingNodeProvider()); } if (item is D.Paragraph dp) { ReplaceRuns(dp, new DrawingNodeProvider()); } if (item is S.SharedStringItem s) { ReplaceRuns(s, new SpreadsheetNodeProvider()); } } TableBinder.ValidateTables(part, this.template, this.Errors); } }
public MainWindow() { InitializeComponent(); //Read XML Document XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(TestXml); //Loading bindingTools, AUTO Binding TYPE CLASS to generic TableBinder <mystruct> bindingObject = new TableBinder <mystruct>(xmlDoc); //set binding properties repeat node bindingObject.bindRepeatNode("/MovieData/Movies/Movie"); bindingObject.bindRepeatNodeProperty("mid", "/MovieData/Movies/Movie"); //SET DATA TO UI DataGrid movieData = (DataGrid)this.FindName("movieData"); movieData.ItemsSource = bindingObject.getDataGrid(); this.btn1.Click += (object sender, RoutedEventArgs e) => { //generate xml DataGrid md = (DataGrid)this.FindName("movieData"); bindingObject.changeXMLData(md.ItemsSource); MessageBox.Show(bindingObject.getXMLString()); }; XmlDocument xmlDoc2 = new XmlDocument(); xmlDoc2.Load("pinlevel.xml"); //Loading bindingTools, AUTO Binding TYPE CLASS to generic TableBinder <PinLevelStruct> bindingObject2 = new TableBinder <PinLevelStruct>(xmlDoc2); //has namespace setup bindingObject2.useNamespace("http://www.ni.com/Semiconductor/PinLevels"); //set binding properties repeat node bindingObject2.bindRepeatNode("/PinLevelsFile/PinLevelsSheet/DigitalPinLevelSets/DigitalPinLevelSet"); bindingObject2.bindRepeatNodeProperty("pin", "/PinLevelsFile/PinLevelsSheet/DigitalPinLevelSets/DigitalPinLevelSet"); bindingObject2.bindRepeatNodeProperty("task", "/PinLevelsFile/PinLevelsSheet/DigitalPinLevelSets/DigitalPinLevelSet"); bindingObject2.bindRepeatNodeProperty("mask", "/PinLevelsFile/PinLevelsSheet/DigitalPinLevelSets/DigitalPinLevelSet"); bindingObject2.bindRepeatNodeProperty("sds", "/PinLevelsFile/PinLevelsSheet/DigitalPinLevelSets/DigitalPinLevelSet"); //bind to UI DataGrid pinlevel = (DataGrid)this.FindName("pinLevelData"); pinlevel.ItemsSource = bindingObject2.getDataGrid(); this.btn2.Click += (object sender, RoutedEventArgs e) => { //generate xml DataGrid md = (DataGrid)this.FindName("pinLevelData"); bindingObject2.changeXMLData(md.ItemsSource); MessageBox.Show(bindingObject2.getXMLString()); }; }
public static SqlParameter BindDishTable(string parameterName, IEnumerable <DishEntity> dishesToUpdate) { dishesToUpdate = dishesToUpdate ?? Enumerable.Empty <DishEntity>(); return(TableBinder.BindTable(parameterName, "typ_Dishes_v1", BindDishRows(dishesToUpdate))); }
public static SqlParameter BindOrderTable(string parameterName, IEnumerable <OrderEntity> ordersToUpdate) { ordersToUpdate = ordersToUpdate ?? Enumerable.Empty <OrderEntity>(); return(TableBinder.BindTable(parameterName, "typ_Orders_v1", BindOrderRows(ordersToUpdate))); }
public static SqlParameter BindUserTable(string parameterName, IEnumerable <UserEntity> usersToUpdate) { usersToUpdate = usersToUpdate ?? Enumerable.Empty <UserEntity>(); return(TableBinder.BindTable(parameterName, "typ_Users_v1", BindUserRows(usersToUpdate))); }
public static SqlParameter BindProviderTable(string parameterName, IEnumerable <ProviderEntity> providersToUpdate) { providersToUpdate = providersToUpdate ?? Enumerable.Empty <ProviderEntity>(); return(TableBinder.BindTable(parameterName, "typ_Providers_v1", BindProviderRows(providersToUpdate))); }