Data seems not be loaded again...

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Data seems not be loaded again...

Post by Zero-G. » Tue 29 Sep 2009 15:36

Hey
I use a Project wide DataContext The code in my class looks like this:

Code: Select all

    Private Shared LinQProvider As VOPT.Voptneucontext.Voptneudatacontext

    Public Sub Initialize()
        LinQProvider = New VOPT.Voptneucontext.Voptneudatacontext(mySQL.GetConnectionString)
    End Sub
    Public Shared Function GetProvider() As Voptneudatacontext
        Return LinQProvider
    End Function
    Public Shared Sub ReNewProvider()
        LinQProvider.Dispose()
        LinQProvider = New VOPT.Voptneucontext.Voptneudatacontext(mySQL.GetConnectionString)
    End Sub
In a form I run the following code:

Code: Select all

            LinqProvider.GetProvider.SubmitChanges()
The data is saved correct to the database.
But when I use the following code (after submit changes):

Code: Select all

        Me.nKundendaten = (From Query In LinqProvider.GetProvider.Kundenstamms _
                           Where Query.Kundenid = KundenId).Single
        Me.bsKundenstamm.DataSource = nKundendaten
The new data is not visible.
But when I call the following code after SubmitChanges, then it works as I want

Code: Select all

LinqProvider.ReNewProvider()
Any suggestions to this? I don't think it is a good idea to dispose the DataContext each time I update my database


THX

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 01 Oct 2009 09:02

I tried to reproduce the problem and failed.
Could you please make a small test project (with one table, to simplify it) and send it to me?

Post Reply