MySql.Data.EntityFrameworkCore vs Pomelo.EntityFrameworkCore.MySql [closed]
MySql.Data.EntityFrameworkCore vs Pomelo.EntityFrameworkCore.MySql [closed]
MySql.Data.EntityFrameworkCore vs Pomelo.EntityFrameworkCore.MySql [closed]
Looking through the GitHub issues, there is no DbEntityValidationException equivalent in Entity Framework Core. There’s a blog post (linked from issue #9662 on GitHub), that gives a code example for performing the validation logic yourself, included here for completeness: class MyContext : DbContext { public override int SaveChanges() { var entities = from e in … Read more
Don’t use FromBody. You’re submitting as x-www-form-urlencoded (i.e. standard HTML form post). The FromBody attribute is for JSON/XML. You cannot handle both standard form submits and JSON/XML request bodies from the same action. If you need to request the action both ways, you’ll need two separate endpoints, one with the param decorated with FromBody and … Read more
Try start your project in the console with the command dotnet new webapi -au Individual You can open your project in VS after that. (to work around the dialog). Then you can use for example the authorize-attribute. But the project is still configured to use Azure Bearer Authentication. You have to decide where to get … Read more
StudentService expects DbContext but the container does not know how to resolve it based on your current startup. You would need to either explicitly add the context to the service collection Startup services.AddScoped<DbContext, SchoolContext>(); services.AddScoped<IStudentService, StudentService>(); Or update the StudentService constructor to explicitly expect a type the container knows how to resolve. StudentService public StudentService(SchoolContext … Read more
public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile(“appsettings.json”); Configuration = builder.Build(); } This seems to do the trick. However unsure this is the proper way to do it. Kinda feels like a hack.
.NET Core 2.1 SDK will be released this week. If you can’t wait until then, add this to your *.csproj <Project Sdk=”Microsoft.NET.Sdk.Web”> <PropertyGroup> <TargetFramework>netcoreapp2.1</TargetFramework> <RestoreAdditionalProjectSources> https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/20180515-07/final/index.json </RestoreAdditionalProjectSources> </PropertyGroup> …. </Project> And download the final SDK from: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.300/dotnet-sdk-2.1.300-win-x64.exe For more details visit: https://github.com/aspnet/Home/wiki/2.1.0-Early-Access-Downloads
Timespan format in .net core is D.HH:mm:nn (so “1.02:03:04” is 1 day, 2 hours, 3 mins, 4 seconds). javascript wont be able to read that (we use a custom JsonConverter for timespan objects for that reason), but .Net can. {“timespan”:”1.02:03:04″}