Forum Widgets
Latest Discussions
EF Core display up to date data on predefine delay
Hi, I have a C#/WPF project for which I use EF Core (database first) to transact with an SQL database. I am struggling with retreiving fresh data from the server on a predefine delay to be displayed on a dashboard. Scenario is this: I have an entity call Cars. Cars has a property that is a virtual ICollection of ToDo call lstToDo Each ToDo entity has a boolean property call Completed. The data of SQL database can be modified by many users. The dashboard is the application running on a computer that no one is using, and that need to display the latest data from the database every X minutes. So in my scenario everything is working fine except that whenever the property Completed is change, in the database, from false to true (or vice-versa) I am unable to get the new value. I tried using Eager Loading but without any luck.It will catch when a new row has been added to the table, but not when a change happen in an existing row. The eager loading I use: myContext.Cars .Include(c => c.lstToDo) .Load(); myCollectionViewSource.Source = myContext.Cars.Local.ToObservableCollection(); Also, in my context I configured it to use LazyLoading. Any suggestion will be more then welcomeAlex_is_programmingOct 03, 2024Copper Contributor98Views0likes0CommentsEntity framework core 8 return double quote in Oracle Query
Hi All, My project using .net core 8, when i debug code, always get error ".net core ORA-00942: table or view does not exist" i would like to show data using this query: var data = _db.employee.ToQueryString(); when i debug, the data variable show this: SELECT "e"."id", "e"."empolyee_name", "e"."employee_code" FROM "employee" "e" My Question: how to remove double quote " in EF query to this? SELECT e . id , e . empolyee_name, e . employee_code FROM employee e. i assume the error table or view does not existbecause my EF query returning double quote "". how to solve it? thanks & regards.tomtom2xOct 03, 2024Copper Contributor143Views0likes0CommentsCannot connect to LocalDB (provider: Named Pipes Provider, error: 0 - No process is at the other end
I'm trying to manually connect to LocalDB (both, SQL Server 2019 and SQL Server 2022 services) creating a new application database using ADO.NET (Microsoft.Data.SqlClient). Everytime I try to connect, I get a generic error telling me that the database file could not be attached. Error.log: 2024-09-17 19:30:18.40 Logon Error: 15350, Severity: 16, State: 1. 2024-09-17 19:30:18.40 Logon An attempt to attach an auto-named database for file C:\Temp\CvTest.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. 2024-09-17 19:31:02.66 Logon Error: 15350, Severity: 16, State: 1. 2024-09-17 19:31:02.66 Logon An attempt to attach an auto-named database for file C:\Temp\CvTest.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. Debugging into the Microsoft.Data.SqlClient source code, the following error turned out to be the real reason behind the issue: A connection to the server could be established, but an error occurred during the login process. (provider: Named Pipes Provider, error: 0 - No process is at the other end of the pipe). What is causing this error? This is my simple test connection setup. It's a cheap connection string that every Microsoft sample is quoting: using SqlConnection con = new SqlConnection(@"Data Source=(LocalDb)\MSSQLLocalDB;Integrated Security=SSPI;MultipleActiveResultSets=True;AttachDBFilename=C:\Temp\CvTest.mdf"); con.Open(); So, it should work off the cuff. But it doesn't. Using SSMS, I can easily connect to the LocalDB instance and create/delete databases promptly, even with the provided path. I already updated from MsLocalDb 15 to MsLocalDb 16, but to no avail.BetterTodaySep 24, 2024Brass Contributor120Views0likes0CommentsC# & EF Core : 2 databases with a Customertable and different Columns
Hello, I have a little PRoblem with my DbContext. For Example: I have two Databases both have a Table Customer. One of the Customers has an Extension of our Software so in the Customertable there are for example 3 more columns. Now when i create the DataAccess Class of the Customer Table i add the Structure from the Customer Table and the 3 extra columns. Now when i Request a Customer for the Customer with the extra Columns all is fine. The Request for the other Customer gets an Error that the last 3 Columns from the Model are not in the Table. Unfortunately it is not possible to add the Columns to the other Customer Table. so my Question is: Is there another Way to geht Records from both Databases with one Model Class and one DBContext? I tried NotMapped and Required in DbContext, I tried Raw SQL but nothing worked. The only Solution is to create 2 DbContexts. But in Our Database there are more such Combinations of Table with different Columns. Can anyone help or provide a way to test? Best Regards PhilipppwendelAug 01, 2024Copper Contributor141Views0likes0Comments.NET solution generator
We have released a free version of our product //entity.services that allows you to generate .NET solutions (including the fully customizable source code) based on simple definitions of your data models. You can find a quick start guide on the GitHub pagehttps://github.com/axlln/es-quick-start Please try it and let us know what you think Thanks, GorangoranJul 01, 2024Copper Contributor220Views0likes0CommentsCan I ignore a single return value when multiple values are returned?
Some time ago, the ability to create a function which has multiple return values was created. Yes, I know this can be avoided by using out... but I was curious. In traditional method calls, the return value can be ignored by not assigning the return value to a variable. I recently decided to use multiple return values in a new method because I wanted to avoid having to worry about the method call when the return value isn't always used. Turns out that may have been an oversight on my part, since I as far as I know, I still have to define a return value. For example, if the return signature of "MyFunction" is (int, bool) and I don't need the bool value, I still have to define it (FAIK... which is the point here): private (int, bool) MyFunction(...) { bool error = false; int someReturnValue = 0; //... does something and sets error if there is a problem return (someReturnValue, error); } public void MyUnconcernedCallerFunction() { int ret; bool error; // what if I don't need to worry about the error here? (ret, error) = MyFunction(...); } is there currently any convention that allows me to not declare the bool error value if I don't need it? (i.e. can I ignore the bool part of the return?) SIDE NOTE: Why isn't there a general forum here? While my example is language specific, the question isn't. This is just a general .NET question having to do with data and there are no general options in the "Choose a Label" options. I couldn't post without choosing one so I just picked the one that made the most sense.primem0verMay 04, 2024Copper Contributor250Views0likes0CommentsInitializing TwitterClient To Access Twitter API
Hi, I keep on getting this error; " while trying to access the Twitter API using the TwitterClient. The Client builds successfully but then it shows this error when I run:dotnet runJeunesseAfricaineSep 22, 2022Copper Contributor439Views1like0CommentsAccess Restrictions and Parties Conflict
First question:Where to find information about the archive of data on a global database attack and including threat flows with a full description of the place in and out of, time, participation, solution and other actions. Second question: After answering the first, if an error or falsification of the problem or intentional deception is detected, further actions and the possibility of restoring Russia in the common process, common problem and situation in the world together Third:Thanks in advance for the decisionFireTeamAug 29, 2022Copper Contributor569Views0likes0CommentsTypes of sdk in .net 6 and their difference
Hi Can we know the difference between these 3 sdk versions in .net 6.0.5 1) SDK 6.0.300 2) SDK 6.0.203 3) SDK 6.0.105 Also if we install SDK 6.0.300 over SDK 6.0.101 ,we will be able to see two versions in control panel . So can you please let us know the difference between these 3 version (SDK 6.0.300,SDK 6.0.203,SDK 6.0.105) of SDKDarshan1385Jul 20, 2022Copper Contributor631Views0likes0Comments
Resources
Tags
- Entity Framework Core7 Topics
- ADO.NET7 Topics
- SqlClient6 Topics
- entity framework5 Topics
- SQLite1 Topic
- ASP.NET Core1 Topic