Thanks for a great product and special thanks for LinqInstantFeedbackSource.
I Would like very much if you could intoduce a Method to the LinqInstantFeedbackSource that would force the GetQueryable Event to Re-Fire.
Please let me explain why.
The most common functionality by far that all my forms need is to allow the user to enter filter criteria and the query the data store and retreive the results and display this in your Grid Control.
The common practice I use is to create a Business Object that contains all the Properties necessary for the user to filter on and a single Method that will return the Queryable String.
I than apply this Queryable String to the Grids Datasource and the results the user is looking for is displayed.
Your new LinqInstantFeedbackSource has been a God Sent in allowing my product to query very large data stores.
The following is an example of the basic structure on how I am currently doing this:
Private mBOFilter As New FilterBO
Private mDismissQueryable As Boolean = False
Private WithEvents mLinqInstantFeedbackSourceFilter As New LinqInstantFeedbackSource
mLinqInstantFeedbackSourceFilter.KeyExpression = "ID"
Private Sub mLinqInstantFeedbackSourceFilter_GetQueryable(???) Handles ???
e.QueryableSource = mBOFilter.GetQuery
e.Tag = mBOFilter
Catch ex As Exception
XtraMessageBox.Show(ex.Message, "GetQueryable", MessageBoxButtons.OK, MessageBoxIcon.Error)
Private Sub mLinqInstantFeedbackSourceFilter_DismissQueryable(???) Handles ???
If mDismissQueryable Then
Catch ex As Exception
XtraMessageBox.Show(ex.Message, "DismissQueryable", MessageBoxButtons.OK, MessageBoxIcon.Error)
In order to force the Grid to display a new Filtered Results from my Business Object I do the Following:
gcFilter.DataSource = Nothing
gcFilter.DataSource = mLinqInstantFeedbackSourceFilter
This is the only way that I know to get the GetQueryable Event to fire again so that it can retreive the new Queryable from my Business Object.
I was getting an Error telling me that my Business Object had been Disposed.
This is why I am using a varible in the DismissQueryable Event to check to see it is OK to dispose of my Business Object.
On the Forms Closing Event I set this Variable to True so that my Business Object will then be disposed of.
Forgive me for such a long introduction to my request.
It seems to me that it would be nice if you could provide a Method to the LinqInstantFeedbackSource that would force the GetQueryable Event to Re-Fire, this way I would not have to set the Grids Datasource to Nothing and than back again to the LinqInstantFeedbackSource object. I would hope that this new method would than not cause the DismissQueryable Event to fire. I could than code the DismissQueryable properly and not have to worry if it is going to dispose of my Business Object at the wrong time.
Thanks for considering my request.
I have discussed this issue with our developers and we came to the conclusion that there is no safe solution to create a method that will work in most scenarios. For instance, we cannot guarantee that after calling this method the LinqInstantFeedbackSource.GetQueryable event for a new datasource will be raised after firing the LinqInstantFeedbackSource.DismissQueryable event associated with an old datasource. Please note that LinqInstantFeedbackSource is not a thread-safe datasource. So, we have no plans to implement this method.
So, the only solution that we can suggest is to re-create a LinqInstantFeedbackSource and assign it to a grid again.
We appreciate your attention to our controls. Please feel free to write us in future. We are always ready to discuss any requests with you.
Thanks for the considering my request and thanks for the explanation.
in your response you said "re-create a LinqInstantFeedbackSource and assign it to a grid again."
Are you telling me that the method I outlined is not the best practice.
It seems to be working for me. But are you telling me that the method I am using could cause me problems.
It so could you show me what the code might look like?
Thanks for all your support and a great product.
You can use the following code to reset a grid datasource:
Dim source As New LinqInstantFeedbackSource source.KeyExpression = "ID" gridControl1.DataSource = source
Since LinqInstantFeedbackSource is not a thread-safe datasource, we strongly recommend that you create a DataContext instance in the LinqInstantFeedbackSource.GetQueryable event handler and dispose it in the LinqInstantFeedbackSource.DismissQueryable event handler as shown in the LinqInstantFeedbackSource help article. The DataContext instance should not be used in other places. In this case, everything should work as expected.
Please let me know if you need any further assistance.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.