WPF Data Virtualization - wpf

I have a WPF DataGrid for which data comes from a stored procedure. I want to know how can I virtualize that data?. I am using ADO.NET Entity Framework. My data in the database changes regularly and it needs to be fetched regularly through my stored procedure. Thanks in Advance.

Try to have a look at this post in order to see if it is useful to you. It is a generic solution to virtualize a collection. There is a sample too. Basically it works by proxing the data inside the collection to intercept when the UI observe the element, when it occours, a page is fetched. The only drawback is that the entity in the collection as to be declared as "proxable", so it must be public and with virtual properties.

Related

XAML, MVVM and waiting for things to happen

Alright, so I'm creating a WPF application using the MVVM design principles anad C# as the language.
I have a singleton for my database (called 'Database'), which just loads some data from an XML file.
I also have a view model (ScenesViewModel) which needs to get this data once it's loaded.
At the moment, the Database calls its Load method in MainWindow.Xaml.cs (just below InitializeComponent) and the constructor of ScenesViewModel gets the data from the Database singleton.
The problem is that the constructor for ScenesViewModel happens before the singleton does its loading.
I suppose I could have a reference to ScenesViewModel in the Database singleton, but that seems like bad practise to me. Is there a better way?
I am, as you may be able to tell, no expert in this field.
Thanks in advance.
Load data from Database async and use await keyword waiting until data loads from database. Go to reference:
https://msdn.microsoft.com/en-us/library/mt674882.aspx

Change the datasource in a report Devexpress WPF Xtrareports

I have a report in Devexpress that is assigned to a certain Datasource and I need to change it to a different Datasource. I want to do this without having to put all the fields back into the report. To help me with this I copied all of my tables and stored procedures to the new Database. Is there a way to do this? This report is going to multiple clients that each have their own naming convention so I would need to be able to change it dynamically. Thank you in advance for your help.
You can comfortably change the connection string and everything should work. This also depends on how you are accessing your data. If you are using standard datasets or some other ORM tool then this should work so long as you have exposed the connection string in your config file.

Using the same backbone relational models to work with both pre-loading and ad-hoc loading of data

I have a tree of models and I'd like to have them load from one big JSON request up front and then be able to change them one at a time without saving the whole tree or reloading the whole tree and without making two versions of each model.
The problem I've encountered is if each of the submodels has a keySource they won't upfront load, but without a keySource you can't do an individual load or save.
My content in the upfront load is the entire object tree fully connected (no id lists) because I didn't see a way around this. Is that the problem? Or is what I'm trying to do just not possible without two versions of the models that are somehow connected?
It is possible to do selective saving if you override the save method of Backbone.Model. I wrote an article on this topic. Your choice if you want to create little sub-models that represent parts of your model. When those are changed, you can get their changedAttributes hash and pass it to the save of the main model. With the method I discuss in the article it is entirely possible to post only parts of your model during a save.
Have you considered using a collection for this? You could override the parse method of collection to create your models. Just a thought.

What is the best way to identify updated items in an in memory list?

I'm using Siaqodb for my client side database engine in a Sync Framework silverlight project. I've switched to siaqodb because microsofts client side solution loads the entire database into memory at once and, as such, has a hard time handling large data.
I've bound a list of SiaqodbOfflineEntity objects to a silverlight datagrid in order to create an editable datagrid. Unlike microsofts solution, you can't bind the database entries directly to the datagrid. You have to query the database and bind a list of in memory objects to the datagrid. This causes a problem in that the database isn't immediatly updated when the datagrid cell is changed. I'm trying to find the best way to handle updates to the database after a change in the cell. I can't just update each item to the database because the siaqodb engine will mark the item as dirty even if no change was made to the object. This will cause conflicts when trying to sync. holding a cached version of the original list and then comparing each property of each object to find which ones have changed seems like it would work, but seems to be a bit cumbersome. I've also tried looking at some of the datagrids events but RowEditEnded doesn't appear to fire when a cell is edited and CurrentCellChanged seems to fire whenever I switch rows (odd).
There's got to be a better solution to this. Anyone have any ideas?
So I've gotten this to work by changing my offline entity classes to implement iNotifyPropertyChange and I think this is a reasonable solution. I set the PropertyChanged event to a function that saves the object to the database. There is a VS package called notifypropertyweaver that will inject this code at compile time, reducing the amount of work needed to be done on auto-generated entity code.

linking gwt combobox with database

I created a gwt app with a gxt combobox. I have it where it pulls data (a list of names apprx 5000) from the database places it in an array which in turns places it in a store. That is then placed in the combobox using set store, so when a user starts typing in the combo it searches through the store for the name. My question: is this the best way to do this or is there another method.
How is the performance loading that list of 5000 names? Does it take a long time to load your page? You may want to think about loading them as you need them so that the gui loads faster.
This article suggest 'lazy loading' gui components
http://googlewebtoolkit.blogspot.com/2008/11/improving-performance-with-on-demand.html
How have you pulled down the list? I assume is via RPC, have you used a Data Transfer Object?, XML?
This link talks about options for serialization http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes
Michael

Resources