Rename model in Swashbuckle 6 (Swagger) with ASP.NET Core Web API

I'm using Swashbuckle 6 (Swagger) with ASP.NET Core Web API. My models have DTO as a suffix, e.g., ``` public class TestDTO { public int Code { get; set; } public string Message { get; set; }...

Using [JsonProperty("name")] in ModelState.Errors

We have a couple of models that override the name via JsonProperty, but this causes an issue when we get validation errors through ModelState. For example: ``` class MyModel { [JsonProperty("id")...

16 Nov at 20:36

Which is better to catch all exceptions except given types: catch and rethrow or catch when?

If I wanted to catch all exceptions except for given types, and those specific types would be re-thrown to be caught in a higher context, would it be better to do: ``` try { //Code that might thr...

28 Nov at 20:6

Servicestack migration to core, fallback router and HandlerFactoryPath

Im migrating my code to a core application. So far so good. i got it all running, but there is one problem. I had a ui (with razor) and using the `CatchAllHandlers`. And for the api i used `HandlerF...

16 Nov at 12:38

ASP.NET How read a multipart form data in Web API?

I send a multipart form data to my Web API like this: ``` string example = "my string"; HttpContent stringContent = new StringContent(example); HttpContent fileStreamContent = new StreamContent(strea...

16 Nov at 12:19

How do you share gRPC proto definitions between services

I am specifying a number of independent services that will all be hosted out of the same server process. Each service is defined in its own protobuf file. These are then run through the tools to giv...

Receive file and other form data together in ASP.NET Core Web API (boundary based request parsing)

How would you form your parameters for the action method which is supposed to receive one `file` and one `text` value from the request? I tried this ``` public string Post([FromBody]string name, [Fr...

12 Jan at 04:20

NSubstitute to return a Null for an object

I am new to unit testing and it sounds to me like it should be easy to get NSubstitute to be able to return null for a method but I cannot get it to work. I have tried this for a Get method that shou...

16 Nov at 07:36

How to include views in ServiceStack.OrmLite T4

The T4 for generating DB Poco files was updated and I see an [IncludeViews](https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/src/T4/OrmLite.Core.ttinclude#L89) variable. However I don'...

15 Nov at 23:46

Determine at runtime which db provider is being used, with EF Core

In our ASP.NET Core and EF Core system, we use different databases for different parts of the system. I need to be able to tell, at runtime, which db provider is being used, because some stuff needs t...

Facebook SDK manually set session token

I am using ServiceStack to authorise a user via either credentials (username or password) or Facebook. I make a call to the ServiceStack auth endpoint /auth/facebook and set a few headers, and pass t...

15 Nov at 22:11

Entity Framework not including columns with default value in insert into query

I have a model that has some columns defined with default values like ``` table.Column<bool>(nullable: false, defaultValueSql: "1") ``` When I save a new entity in the database using `context.Sav...

C# UDP Broadcast and receive example

Problem: I am trying to bind a udp socket on a specific address. I will broadcast out a message. That same socket will need to be able to receive messages. Current code: ``` static void Main() { ...

15 Nov at 18:23

Disabling Entity Framework proxy creation

From what I've read, setting `ProxyCreationEnabled = false` will prevent change tracking and lazy loading. However, I'm not clear on what change tracking covers. If I disable it and get an entity fr...

15 Nov at 16:30

Handling exception in asp.net core?

I have asp.net core application. The implementation of configure method redirects the user to "Error" page when there is an exception ( in non Development environment) However it only works if the...

Accessing ASP.NET Core DI Container From Static Factory Class

I've created an ASP.NET Core MVC/WebApi site that has a RabbitMQ subscriber based off James Still's blog article [Real-World PubSub Messaging with RabbitMQ](http://www.squarewidget.com/real-world-pubs...

CreateParam does not have an implementation

I am trying to run the Sqllite inmemory database together with ServiceStack. Console App in Visual Studio .net 4.6.1 (if I run the same code in LinqPad it is working fine) Platform target: x64 Ins...

15 Nov at 14:46

Reason for ExtractMethodCodeRefactoringProvider encountered an error and has been disabled?

I'm getting this error, when I'm trying to extract the method from code by using right-click on a selected code(Quick Actions and Refactoring) or `Ctrl + .`. I'm using Visual Studio 2015. I'm able to...

15 Mar at 10:7

FTP client in .NET Core

Can I download file / list files via FTP protocol using ? I know, I can use [FtpWebRequest](https://learn.microsoft.com/en-us/dotnet/api/system.net.ftpwebrequest) or [FluentFTP](https://www.nuget.org/...

5 Oct at 13:44

Pattern for caching data in Asp.Net Core + EF Core?

I have an Asp.Net Core + EF Core REST service. I created a DbContext class for a DB I want to call a SP on. The method pretty much looks like: ``` public IQueryable<xxx> Getxxxs() { return Set<xx...

EF Core - Table '*.__EFMigrationsHistory' doesn't exist

I created my DbContext and added it in DI, however when I do `dotnet ef database update -v` it does not want to create the migrations table `__EFMigrationsHistory`. Is there some other command that...

Invalid DeviceToken Length when sending passkit push by PushSharp

I try to use PushSharp in an Apple passkit related project. My current problem is about passkit pushes. When I try to create my notification, it says > device tokent length is invalid (exact exce...

Plotly js responsive graph in div

I am making a page with dynamically created divs that resize on mouseover using a simple css class. I use it so these divs are small when the page is loaded then if a user wants a closer look they jus...

7 May at 08:26

How to retrieve latest record using RowKey or Timestamp in Azure Table storage

Tricky part is `RowKey` is `string` which is having value like `Mon Nov 14 12:26:42 2016` I tried query using `Timestamp` like ``` var lowerlimit = DateTime.UtcNow; // its should be nearer to table...

14 Nov at 17:46

How do I properly use the Api Attribute in ServiceStack to name a service in SwaggerUI?

Using Swagger-UI and ServiceStack, I'm trying to use the `Api` attribute to name my services a little cleaner. I am having a hard time figuring out where the attribute needs to be for it to add a `de...

14 Nov at 14:20