skip to Main Content

Asp.net – Easier way to select a string in EF Core?

I would like to get the value of @@SERVERNAME. The following code works: [Keyless] public class EntityString { public String Value { get; set; } = String.Empty; }; // inside MyDbContext.OnModelCreating modelBuilder.Entity<EntityString>(); // inside MyDbContext public IQueryable<EntityString> QueryServerName() => Set<EntityString>().FromSqlRaw("SELECT…

VIEW QUESTION

Asp.net – TempData Peek Issue

I am using TempData for temp storage of a list item. I have used below code in program.cs builder.Services.AddSingleton<ITempDataProvider, CookieTempDataProvider>(); builder.Services.AddSession(); //Other middleware app.UseSession(); On a get request i have created a view model and stored the data from viewmodel…

VIEW QUESTION

Asp.net – IIS Rewrite Module exclude bots but allow GoogleBot

I'm using the following IIS Rewrite Rule to block as many bots as possible. <rule name="BotBlock" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_USER_AGENT}" pattern="^$|bot|crawl|spider" /> </conditions> <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" /> </rule> This rule blocks all requests with an…

VIEW QUESTION

The 'GetUriByAction' method in the LinkGenerator class in Asp.Net Core is not defined in the Repository layer of the project

The EmployeeLinks class in the Repository layer. using Contracts; using Microsoft.AspNetCore.Routing; using Entities.LinkModels; using Entities.Models; using Shared.DataTransferObjects; using Microsoft.AspNetCore.Mvc.Formatters; using System; using System.Collections.Generic; using System.Linq; using Microsoft.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; namespace Repository.Extensions.Utility { public class EmployeeLinks :…

VIEW QUESTION
Back To Top
Search