|
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.
What do you think?
|
|
|
|
|
hey every one!
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.
any one please help me.
|
|
|
|
|
You can't. The DropdownList control renders an HTML <select> element, which doesn't support that behaviour.
If you could switch to a TextBox , you could combine it with a <datalist>[^] to provide autocomplete suggestions as the user typed.
Otherwise, any solution will involve using Javascript.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello All,
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:
https://github.com/vlmbts/MVCcoreExploreCalifornia/commit/5ef856d8e497518553f641ad9df50a9c2b2db044
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.
3
4 From Package Manager Console:
5
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!
|
|
|
|
|
You should probably look at using an updated package, the one you are loading is well out of date and probably not supported.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
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?
|
|
|
|
|
Hi Good Day,
I have been trying to redirect my http web pages using the rewrite module.
The module works in converting http link to https, but then the converted url path is not as expected.
For example:
original link: http://servername/folder/page_x.aspx
Converted link: https://servername/page_x.aspx
To achieve expected result, updated the rules in web.config file with various combinations of constructing the target url but i have had no luck.
Any tips/direction towards the fix will be really helpful.
|
|
|
|
|
This rule works fine for me:
<system.webServer>
<rewrite>
<rules>
<rule name="RequiresSSL-Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" redirectType="Temporary" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a model as follows:
[Key]
public int pmId { get; set; }
[Required]
public int pmNumber { get; set; }
[Required]
[MaxLength(50)]
public string costCenter { get; set; }
[Required]
[MaxLength(15)]
public string serviceType { get; set; }
[Required]
[MaxLength(50)]
public string destination { get; set; }
[Required]
[MaxLength(50)]
public string workCenter { get; set; }
[Required]
public DateTime creationDate { get; set; }
[Display]
[Required]
public DateTime startDate { get; set; }
[Required]
public DateTime endDate { get; set; }
[Required]
[MaxLength(100)]
public string mainFileName { get; set; }
public DateTime? returnDate { get; set; }
public string? status { get; set; }
[MaxLength(100)]
public string? fileName { get; set; }
public int? uploader { get; set; }
public bool? isDownloaded { get; set; } = false;
public virtual AppUser user { get; set; }
public PM()
{
}
The Foreign Key is id which is Primary Key of the EF Core Identity table. In a form, I need to insert a new row in PM table. I can fill all necessary columns using the following code:
var inputElements = new PM()
{
pmNumber = Convert.ToInt32(adminModel.pmNumber),
costCenter = adminModel.costCenter,
serviceType = adminModel.serviceType,
destination = adminModel.destination,
workCenter = adminModel.workCenter,
creationDate = DateTime.Now,
startDate = DateTime.Now,
endDate = DateTime.Now,
mainFileName = newFileName
};
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.
modified 19-Dec-21 13:22pm.
|
|
|
|
|
I added the following code to PM model:
public int userId { get; set; }
and changed the navigation property to the following code:
[ForeignKey("userId ")]
public virtual AppUser user { get; set; }
|
|
|
|
|
|
How would we possibly know where you got something?
If you want help, you need to ask better questions.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I think the question deserves an upvote for the depth of thought that went into that question!
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
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:
ReportViewer1.aspx
ReportViewer1.aspx.cs
ReportViewer1.aspx.designer.cs
in ReportViewer1.aspx.designer.cs I changed this line:
protected global::Microsoft.Reporting.WebForms.ReportViewer ReportViewer2;
In ReportViewer1.aspx.cs I name dthe class like this:
public partial class ReportViewer1
Inside of this class I changed all ReportViewer1 to ReportViewer2.
I also modified ReportViewer1.aspx.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReportViewer1.aspx.cs" Inherits="PrismWeb.reports.ReportViewer1" EnableEventValidation="false" %>
rsweb:ReportViewer1 ID="ReportViewer2" runat="server" Height="100%" Width="100%">
Call from UI:
/reports/ReportViewer1.aspx crashes somewhere on the server, cannot fine where.
However, if I call /reports/ReportViewer.aspx with same changes I did in ReportViewer1.aspx then it works fine. I just can't figure out why calling ReportViewer1.asx is not working.
Please note, I am not a c# developer, I might be doing something abviously wrong. Please help.
Thanks
|
|
|
|
|
Quote: crashes somewhere on the server What are the symptoms of that "crash" - any errors reported?
|
|
|
|
|
I use the following code for dependency injection of Register/Login controller. The problem is that I cannot use Repository pattern I have created previously.
private readonly UserManager<AppUser> _userManager;
private readonly SignInManager<AppUser> _signInManager;
private readonly IUserRepository _userRepository;
public HomeController(UserManager<AppUser> userManager, SignInManager<AppUser> signInManager, IUserRepository userRepository)
{
_userManager = userManager;
_signInManager = signInManager;
_userRepository = userRepository;
}
When I run the code, the following error is occured:
Quote: InvalidOperationException: Unable to resolve service for type 'CustomizedIdentity.Repositories.IUserRepository' while attempting to activate 'CustomizedIdentity.Controllers.HomeController'.
modified 6-Dec-21 14:00pm.
|
|
|
|
|
You haven't registered an implementation of your IUserRepository service in your DI container. You need to fix your service registration code to register that service, and any services it depends on.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
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.
|
|
|
|
|
Hi,
I'm creating models for my ASP.NET Core project. I want to use "Code First" approach to create database and tables. Please check these annotations to be correct:
[Required]
[DataType(DataType.Date)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/dd/yyyy}")]
public DateTime creationDate { get; set; }
[Required]
[DataType(DataType.Time)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:HH:mm:ss}")]
public DateTime creationTime { get; set; }
And please tell me that what 0 means inside the curly braces.
|
|
|
|
|
The DataFormatString value is a format string to convert a date to a string in the format shown. The zero gives the position of the data parameter (following the format string) when the format is used, like:
string theDate = string.Format(DataFormatString, someDateTimeValue);
See String.Format Method (System) | Microsoft Docs[^]
|
|
|
|
|
Is data annotation for the time correct?
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:HH:mm:ss}")]
|
|
|
|
|
I deliberately did not answer that part because I don't know the answer. Does it correspond to the documentation?
|
|
|
|