Questions tagged [core]

44952 questions
1

votes
1

answer
195

Views

ASP.NET MVC Core Azure Blob Image Resizer

I've got an ASP.NET core application that uploads images to Azure. I am attempting to resize an image using Magick.NET before uploading said image to Azure Blob container. So far, I've managed to save the image to a folder in a local hard drive. Is this the correct way of writing this? [HttpPost] [V...
Chris H.
1

votes
0

answer
286

Views

Is there a way to escape colon in appsetting.json dictionary key in aspnetcore configuration?

I have this provider dictionary in appsetting.json 'AppSettings': { 'Providers': { 'http://localhost:5001': 'Provider1', 'http://localhost:5002': 'Provider2' }, 'ArrayWorks': [ 'http://localhost:5001', 'http://localhost:5002' ], 'SoDoesColonInDictionaryValue': { 'Provider1': 'http://localhost:5001',...
Whoever
1

votes
1

answer
134

Views

Problems with input masks in PartialViews - Asp.Net Core

I'm having trouble with input masks (bootstrap) on all screens. I found the following interesting: All my Views that are returned in the form of 'PartialView', the input masks do not work. For tests, when I create a View and a controller that returns a View, everything works correctly. This clearly...
Master JR
1

votes
1

answer
241

Views

How can I bind a SecureString or char[] parameter in .NET Core without using strings

When storing a string that is secret (eg a password or key) it is bad practice to use a System.String as strings are immutable and you cannot schedule garbage collection to remove them from memory. Microsoft recommends using SecureString to avoid this, where the content is also encrypted at rest. Se...
mrtimuk
1

votes
0

answer
80

Views

NHibernate many to one results in Operation is not supported

Hi I'm making a web app on .net core 2 using NHibernate. When I try to add many to one mapping in .xml I get this exception: fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id '0HLEFGR5COP4F', Request id '0HLEFGR5COP4F:00000002': An unhandled exception was thrown by the application. System....
Andrej Paučo
1

votes
1

answer
212

Views

Identity Server: Add claims to ClaimPrincipal with hybrid flow in MVC client

I am setting up an identity server and are having trouble understanding why I cannot access a newly added claim from my MVC site. I am using the quickstart sample no 5: (Link on github) with the following changes in the identity server: public static IEnumerable GetIdentityResources() { return new L...
Sebastian
1

votes
1

answer
482

Views

Populating and Accessing ClaimsIdentity in ASP.NET Core

I have a .NET Core 2.1 application where I have an authentication handler which I use to extract the value of a header. How do I add this value to my ClaimsIdentity, and how can I then access it from my controller? I have the following code which works on all my controller actions: public class Cust...
Robbie Mills
1

votes
1

answer
252

Views

Work with one dbContext and multiple connection string in EntityFramework and .net core dependency injection

I'm working in a project using EntityFramework Core and .net core 2.0, which I need to connect to multiple databases to get data to execute a cron, i injected DbContext.cs in startup.cs like above: services.AddDbContext(); I use it in my UnitOfWork.cs like this : public class UnitOfWork : IUni...
Boubakr Echieb
1

votes
0

answer
135

Views

Who insert Angular scripts in ASP.NET Core Angular template project

I created a new ASP.NET Core 2.1 Angular project. What is interesting is that there is index.html file inside ClientApp/src which is hosted as default page. I would like to know, which code triggers that index.html is served by default? In my old application from universal template Controllers an...
Makla
1

votes
0

answer
78

Views

How to force an order in migrations in c# EF core 2.0 code first

I have two tables: 'Parents' and 'Children': public class Parent { public int Id { get; set; } public string ExternalId { get; set; } public string Description { get; set; } } public class Child { public int Id { get; set; } public string ExternalId { get; set; } public string Description { get; set...
Richard
1

votes
1

answer
199

Views

Application crashes when saving in CoreData concurrently in Swift

Application crashes when saving in Core data do { try context.save()
Fattaneh Talebi
1

votes
1

answer
398

Views

IdentityServer4 - LogoutRequest.PostLogoutRedirectUri is null

I have an identity server project that I am working on that for some reason is setting the log out url as null. Using the 'BuildLogoutViewModelAsync(logoutId)' function found in the QuickStart, this line is returning null, but in the log the 'post_logout_redirect_uri' is set and is set correctly. v...
Rodney Pannell
1

votes
1

answer
1.1k

Views

Data Seeding by HasData not working on Visual Studio for Mac

I am getting some wonky behavior in Visual Studio for MacOS. I recently installed .NET Core 2.1 SDK and then upgraded a project from 2.0 to 2.1. I wanted to try out the new Data Seeding feature, which lets us seed data into an entity in an override of OnModelCreating method. modelBuilder.Entity().H...
Caffiene Monkey
1

votes
2

answer
307

Views

Assert that all properties but some are null

I have mapping methods, that maps model A to model B. I write unit tests for all of there. I want to somehow nicely handle situation when destination model has a lot of properties, but most of them are null. The test purpose is to test that some small number of properties were correctly mapped and o...
Martin Volek
1

votes
0

answer
69

Views

UrlHelper sometimes not returning the base url

I'm creating a .NET Core 2.1 web api and am experiencing issues with the UrlHelper. I use the Link method to determine links from one resource to another. Most of the time it is working just fine, but sometimes the resulting string lacks the base url. E.g.: Request 1: http://localhost:1234/api/books...
Geoffrey
1

votes
0

answer
46

Views

communication solution between azure app service and external program

I am building a website using ASP.NET MVC which gonna be deployed as Azure app service and I got another program which will interact with the website backend in real time and sends live data which needs to be displayed on the website as live data and it is bi-directional. We used message queues (Azu...
1

votes
0

answer
42

Views

Twitter:: External Callback-Not returning User’s Email address

I’m implementing external login in Asp.Net Web API application using Asp.Net core 2.0 with C#. While login using Twitter option, the application is redirecting to Twitter login page and after successful login, it is calling application’s callback method. In that method, we’re trying to get log...
Devendra Lodha
0

votes
1

answer
16

Views

Returning Status Codes from a class outside my Controller

I am trying to move logic that I do on all of my controllers into a class to follow the 'Do Not Repeat Yourself' principle. What I am struggling with is how to elegantly return an error code. Here are some examples of what I currently do within each controller: public class SomethingRequest { public...
thalacker
-1

votes
0

answer
13

Views

Catch multiple same type exception

Let's say I have a service that saves some objects to the db. I'm injecting the repo into it with DI. public class MyService { ... public async Task UpdateAll(IEnumerable objects) { foreach (var o in objects) { try { var tempObject = _injectedRepo.GetBySomeProperty(o.someProperty); if (tempObject !...
itVico
1

votes
0

answer
119

Views

How to host a combined angular 2 and dotnet core site on IIS

I'm building a website and wanted to use angular cli as frontend with .NET core 2 as a REST based backend service. So I created a new angular cli project and then created a webapi project using dotnet cli. I altered the angular.json file to make the output end up in the wwwroot folder of the WebApi...
Jimmy Byström
1

votes
0

answer
176

Views

Cache entire response to distributed cache (Redis)

I would like to cache an entire page to a distributed cache (specifically Redis) in an ASP.NET Core 2.1 MVC web app. When a user visits a page, the code in the action method and the view cshtml is executed, and a page is generated and sent to the user. I would like this page to get cached at the end...
Gary
1

votes
0

answer
46

Views

iOS: Decoding YUY2 video frames

I am attempting to consume YUY2 video and display it one frame at a time on an iOS device. I will eventually be working with stream of YUY2 data but at the moment I am using a recorded file. Unfortunately, I cannot seem to get this conversion right. I'm using CoreVideo, and my code is based on a bun...
Nate Birkholz
1

votes
0

answer
331

Views

.Net Core: can't pass “geography” parameter to SQL Server stored procedure

I want to pass a parameter of SQL Server type geography to a stored procedure from .Net Core. So far, I have installed the System.Data.SqlClient and Microsoft.Spatial packages. Here is my code: using (SqlCommand cmd = new SqlCommand('myproc', connection)) { cmd.CommandType = CommandType.StoredProced...
A. Abrams
1

votes
0

answer
87

Views

Custom entities in Entity Framework

I'm using EF6 in my ASP.NET Core 2.0 I have Foo table as : Foo(ID,NAME) and Bar as Bar(ID,FOO_ID,TYPE) and a view just like this : Create View GETFooBar as select F.ID FOO_ID,F.NAME FOO_NAME,B.TYPE FOO_TYPE from Foo F join Bar B on F.ID = B.FOO_ID Can I do the following: public Class FooBar{ pub...
Arsalan
1

votes
4

answer
1.2k

Views

Gzip compression middleware not working in asp.net core 2.0

I am unable to get Gzip compression middleware to work in asp.net core 2.0 (or 2.1). I created a new project using the 'Blank' Web Application template and have the following code in Startup.cs: public void ConfigureServices(IServiceCollection services) { services.AddResponseCompression(); } // This...
Mark Miretsky
1

votes
1

answer
60

Views

GroupBy() not grouping correctly on List<T> property [duplicate]

This question already has an answer here: GroupBy on complex object (e.g. List) 3 answers I am trying to conditioanlly show a 'week list'(each day of a week) either showing all 5 days(Mon-Fri), or a single 'list item'(single list item represnting all days of week) based on if all items are the same...
Emo333
1

votes
1

answer
131

Views

Silent SSO login with Azure B2C and Open Id Connect in .NET Core MVC Application

We would like to implement functionality where user should be logged silently over Single sign-on. The user go to the application A and log into. Now he goes to the application B, which is using the same tenant as application A. At this moment to log into the application B, it is necessary by user t...
Anton Kalcik
1

votes
1

answer
335

Views

Core data -[Decodable.Address initWithCoder:]: unrecognised selector sent to instance

I have implemented JSON parsing with swift Codable and storing it with Coredata . My Code works fine while storing the JSON and fetching entities which don't have 'transformable' attribute. But fetch entity fails and crashes with below log in case where any of it attribute is transformable. I need t...
Shirish
1

votes
0

answer
127

Views

Best practice to deploy dacpac along asp.net core

I am trying out to figure what would be the best way to deploy a dacpac along an asp.net core application. Its an application that we provide to external users for download as an on-premise version to be installed in Azure, as such I am trying to make it a smooth as possible For now now I was plan...
MaxTheMax
1

votes
0

answer
355

Views

Print a form from asp.net core 2.0 for customer

We are searching for a solution for the following problem: We gather some data on our website via an HTML form. This data shall be used for creating a form which in the end shall be printed and physically signed. The data is stored in an MSSQL database. We don't know which is the best and easiest to...
mabota
1

votes
2

answer
50

Views

LINQ: How to filter collection by data in related table

I have two Entity Framework Core entities: public class JobOrder { public int Id { get; set; } public string JobTitle { get; set; } public string Status { get; set; } ... public IEnumerable JobOrderUsers { get; set; } } public class JobOrderUser { public int AppUserId { get; set; } public AppUser Us...
Alex
1

votes
1

answer
704

Views

Scaffolding Keyless Models on entity framework core 2.1

I have a simple console app and i am trying to scaffold all my models but i have some of them that does not have defined a primary key, Entity framework 2.1 give support to that kind of tables but still get this warning Unable to identify the primary key for table 'dbo.myTable'. Unable to generate...
Dennis Gonzalez
1

votes
0

answer
328

Views

Update only some Model fields using generic Repository Entity Framework core

I have the Users Model follows: Model Users.cs [Key] [Column('cod')] public int Cod { get; set; } [Column('nome')] [StringLength(120)] public string Nome { get; set; } [Column('sobrenome')] [StringLength(80)] public string Sobrenome { get; set; } [Column('email')] [StringLength(60)] public string Em...
MariINova
1

votes
2

answer
337

Views

Entity Framework and PostgreSQL: quotation marks issue

The problem I am facing is around SQL queries in pgAdmin 4. Entity Framework (including its Core edition) capitalizes the names of tables and columns. Which means your SQL will then look something like select e.'Id', e.'Text' from 'Entries' e where e.'Text' like '%implicated%' I was googling the way...
Alex Herman
1

votes
0

answer
70

Views

In Swashbuckle how to I filter a model based on status code

I have an api project where every method returns its response wrapped in an ApiResponse object. The class looks like this public class ApiResponse { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public T Data { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] p...
user3599659
1

votes
0

answer
311

Views

How to use a custom domain with ASP.NET Core + Kestrel + Nginx

I have deployed my app to my virtual linux machine and everything works fine. I have redirect the domain to my ip and it works fine. The problem is when it redirects my domain to my linux machine ip the url shows my ip instead of the domain. Here's my Nginx file: server { listen 80; server_name mydo...
João Ribeiro
1

votes
1

answer
81

Views

How to color manage AVAssetWriter output

I'm having trouble getting a rendered video's colors to match the source content's colors. I'm rendering images into a CGContext, converting the backing data into a CVPixelBuffer and appending that as a frame to an AVAssetWriterInputPixelBufferAdaptor. This causes slight color differences between th...
Hooper
1

votes
0

answer
51

Views

Built-in strongly-typed validator in ASP.NET Core?

Currently my models implement IValidatableObject what means they aren't lean POCO's as I'd like them to be. If I'm using ValidationAttribute then I have to deal with object. If I'm using ActionFilterAttribute then I have to deal with context.ActionArguments collection. IS there a built-in strongly-t...
abatishchev
1

votes
0

answer
444

Views

How to Debug Angular 5 using ASP.NET Core in Visual Studio 2017

I created a ASP.NET Core project in Visual Studio 2017 following the VS available template with Angular 5. After that I've configured my tsconfig.json : And in Startup.cs I added Spa configuration: app.UseSpa(spa => { spa.Options.SourcePath = 'ClientApp'; if (env.IsDevelopment()) { spa.UseAngular...
Radu Olteanu
1

votes
1

answer
216

Views

Asp.Net MVC Core 2 web site with Wordpress in subdirectory

My hosting plan includes 1 site. I have installed a Asp.Net MVC Core 2 project on that site and it is working as designed. Now I would like install a blog on the same site in a subdirectory. The blog I am using is Wordpress. Wordpress is installed to a subdirectory on the Asp.Net MVC Core 2 site. Wh...
seisal

View additional questions