EF Core is smart enough to run the ToList after the entire SQL query has been built. I am guessing the GetAllMessages part applies the filtering to the query as well; if so, they're the same in the same query builder. You need to understand two parts here. First, EF Core builds a single query that is sent to the database engine. The fluent way to build a query helps you apply all sorts of ORDER BYs and WHEREs to the SQL query; including any JOINs. Then, the database query planner kicks in and prepares how to capture the data. Database query plan will always try to find the optimum way to execute the SQL commands and return the results.
Since query plans are highly based on databases themselves, I would link a Wikipedia article: Query plan - Wikipedia, you can search for the documentation per your database engine.
Now, the performance would take a toll if you are filtering on the server side and not on the database side. What I mean is, that you capture the list of the records from the database and then filter them in the memory of the server process. Boy, that'd hurt a lot.
Applies to modern async-based EF-only: Finally, the performance can be improved (in terms of number of requests per second) if you would use ToListAsync() instead of ToList(), where the later is a synchronous operation and would block the thread.
I'm creating a .net app in which many clients will have their own scheduled tasks. Each client will be a plugin that gets added to the main app with their own jobs and settings for when to run. What I'm looking to dois have create a job scheduler that will find all the tasks and run them based on the client settings.I'm looking at hangfire, quartz.net, and azure functions/webjobs.
Since this will be hosted on azure, I'm leaning towards an azure function that would run every minute, read a database to find each task, use reflection to find the scheduled task class since they're plugins, check the settings for how often to run the task and run it accordingly. I would just like to hear some ideas from what others have tried with success
To answer the question you have to assess how many users and how often these jobs are invoked. Since azure functions are billed per invocation it might be a huge cost-saver or real burden. So in case you estimate low usage I'd suggest azure functions, otherwise stick to quartz/hangfire. Tbh I've never used hangfire but quartz is a nice reliable library that allows persisting jobs in DB which is pretty convenient.
I am starting on a project, together with other developers. The customer is a community and wants to have a website where people can apply for a service. According to their family status, the persons are being distinguished into cases, i.e. married, divorced, living together with a partner, widow. For every case there exist some different questions, although most of them are common (like bitrhday place, father name and so on). The technology used is ASP.NET Core MVC.
The one proposition is to make a model, a controller and a view for every family status. The name of the classes should accordingly change, like MarriedModel.cs, MarriedController.cs, or DivorcedModel.cs, DivorcedController.cs etc.
My approach is a more OOP one. Since we have an entity of a Person, this is our model class. Family status, liked married, divorced etc, consists an attribute. The actions should change dynamically passing the attribute parameter into the controller which would control the view appropriate.
I find that this way we avoid redundancy and code copying, which is very bad enginnering. Moreover we have less code in the end. Others say that with the first way we would gain on flexibility in case something changes during developement.
i was tried to drop down with searchable way means when i try to write the first letter of the option the value should come first, with out Jquery or java script only in c# drop-down control properties.
Wondering why my system is giving me the message: "Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 2.2 ... use a version of the .NET SDK that supports .NET Core 2.2"
I put line numbers below for ease in illustrating where I'm coming from. From what I can tell based on the Package Manager Console (see line numbers 19, 23, 25 and 28 below) I have .NET Core 2.2, am I correct? If I already have .NET Core 2.2, then I wonder what am I missing that is preventing a successful program run?
To make sure I am not missing any detail in showing what I am seeing, I have uploaded the full solution to github shown in the link:
If I uninstall then reinstall things in a trial and error fashion hoping that somehow things can get fixed, I can actually do more harm than good, so I do not wish to pretend having significant experience
installing Visual Studio and .NET Core 2.2; instead I'd like to ask the guidance of experts here who have more experience than I do in this area.
1 From Error List Window:
2 Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2.
4 From Package Manager Console:
6 PM> dotnet --info
7 .NET SDK (reflecting any global.json):
8 Version: 6.0.101
9 Runtime Environment:
10 OS Name: Windows
11 OS Version: 6.3.9600
12 OS Platform: Windows
13 RID: win81-x64
14 Base Path: C:\Program Files\dotnet\sdk\6.0.101\
15 Host (useful for support):
16 Version: 6.0.1
17 .NET SDKs installed:
18 2.1.526 [C:\Program Files\dotnet\sdk]
19 2.2.207 [C:\Program Files\dotnet\sdk]
20 6.0.101 [C:\Program Files\dotnet\sdk]
21 .NET runtimes installed:
22 Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
23 Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
24 Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
25 Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
26 Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
27 Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
28 Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
29 Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
30 Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Thanks in advance for all the help you could give.
Please don't repost if your question does not appear immediately: all of these went to moderation and required a human being to review them for publication. In order to prevent you being kicked off as a spammer, both had to be accepted, and then I have to clean up the spares. Have a little patience, please!
I've deleted the spare version.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
Thanks for your suggestion I will keep it in mind and make sure I do it as soon as I am able to move to Windows 10. Currently, I do not have much choice except to stick around with Windows 8 whose tools are no longer supported.
As an update, I looked at the error message closer and noticed I am running Microsoft .NET Framework Version 4.7.02053 on Microsoft Visual Studio 2017, using SDK 2.2.207 (from the Microsoft download site Download .NET Core 2.2), and therein I think lies the problem.
I can't believe it skipped my eyes that SDK 2.2.207 has Visual Studio support for Visual Studio 2019 so obviously the SDK I should have installed was SDK 2.2.110 as it is the one carrying Visual Studio support for Visual Studio 2017 not SDK 2.2.207 so it's my bad.
Can I uninstall SDK 2.2.207 and restart and then install SDK 2.2.110 without any problem?
But, because of relational nature of my tables, I need to specify userId when creating a new row in PM table. How can I set Foreign Key? I can detect userId using Session object but I don't know how to insert it in the table.
I want to have two ReportViewer controls in my VS project. I have two completely different types of reports and I want to split them between two RepportViewers that would be processed in two ReportViewer.aspx.cs. I have create copies of three files:
I am trying to create a site on IIS that can allow users to manually thru their mobile phones (yes they will have access to this internal site), and use their AD username/password to login. Anyone that's valid is allowed in. Once authenticated will present the next page. Plus that next page wouldn't allow them on it unless they are authenticated. Does anyone have any sample ASP.NET Web examples to get me started? Don't usually develop applications within IIS other than HTML pages so looking for any samples to get me started. Having a hard time finding one that isn't how to use Azure online.
Last Visit: 31-Dec-99 18:00 Last Update: 4-Oct-23 4:01