Hi,
I want to make real-time reporting in my app. I want to use DispatcherTimer to execute method with query and get data for ObservableCollection.
Dim MetricsTimer As New DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Render, Async Sub() Await FillProductivityEE(), Dispatcher.CurrentDispatcher)
Public Async Function FillProductivityEE() As Task Using entityconn As New TimerConnection() entityconn.Configuration.LazyLoadingEnabled = True Dim result = Await (From r In entityconn.tbl_Main_Timer Order By r.ID Descending).ToListAsync() UserDetails.Clear() UserDetails.Add(result) UserView = CollectionViewSource.GetDefaultView(UserDetails) entityconn.Dispose() End Using End Function
'Thanks to this' my designer throw an exception:
"UnintentionalCodeFirstException: The context is being used in Code First mode with code that was generated from an EDMX file for either Database First or Model First development. This will not work correctly. To fix this problem do not remove the line of code that throws this exception. If you wish to use Database First or Model First, then make sure that the Entity Framework connection string is included in the app.config or web.config of the start-up project. If you are creating your own DbConnection, then make sure that it is an EntityConnection and not some other type of DbConnection, and that you pass it to one of the base DbContext constructors that take a DbConnection. To learn more about Code First, Database First, and Model First see the Entity Framework documentation here: http://go.microsoft.com/fwlink/?LinkId=394715"
+ Timer is not called from constructor.
Thank you for any points on that