Filtering on Include in EF Core

I'm trying to filter on the initial query. I have nested include leafs off a model. I'm trying to filter based on a property on one of the includes. For example: ``` using (var context = new Blogging...

16 Nov at 13:38

Check size of uploaded file in mb

I need to verify that a file upload by a user does not exceed 10mb. Will this get the job done? ```csharp var fileSize = imageFile.ContentLength; if ((fileSize * 131072) > 10) { // image i...

30 Apr at 17:51

EF6, SQLite won't work without App.config

I'm trying to make a plug in that will use EF6.1 and SQLite for an app where I can't change the App.config so all the configuration and connection string needs to be set in code. I found this answer ...

2 Sep at 18:5

Can Nullable types be sent through Protocol Buffers?

The [Proto3 C# Reference](https://developers.google.com/protocol-buffers/docs/reference/csharp-generated#wrapper_types) contains the following text: > Most of the well-known types in proto3 do not af...

25 Apr at 16:9

Project X targets '.NETStandard,Version=v1.6'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.6.1'

I really wanted to be a good citizen... copied all my classes to .net standard libraries. Just to find out that my test DLL can't use it. I get the following error > Project X targets '.NETStandard,...

28 Dec at 06:41

An enumerable sequence of parameters (arrays, lists, etc) is not allowed in this context in Dapper

I have the following code: ``` static void Main(string[] args){ string sql= "SELECT * FROM Posts WHERE 1=1 "; SqlParameter[] @params= SetDynamicParameter(ref sql, "Param=Value", "Para...

25 Apr at 14:15

Azure DocumentDB Read Document Resource Not Found

I'm building a .Net Console application to read information in a DocumentDB. The console app has data coming from an EventHub and inserts/updates recent data as it comes into the cloud. I am trying t...

22 Dec at 18:16

BadImageFormatException Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format

I am getting following runtime error, with my console application(VS2012) which refers to "dcasdk.dll". .Net Framework of the console app is 4.5, platform target is "Any CPU". ``` Could not load file...

Setup RabbitMQ consumer in ASP.NET Core application

I have an ASP.NET Core application where I would like to consume RabbitMQ messages. I have successfully set up the publishers and consumers in command line applications, but I'm not sure how to set i...

25 Apr at 11:23

Negate `.Where()` LINQ Expression

I understand that you can do the following: ``` enumerable.Where(MethodGroup).DoSomething(); ``` and that this achieves the same thing as: ``` enumerable.Where(x => MyMethod(x)).DoSomething(); ```...

25 Apr at 11:16

Is it possible to redirect request from middleware in .net core

What I'm trying to achieve is this: When someone visits: `smartphone.webshop.nl/home/index` I want to redirect this from middle ware to: `webshop.nl/smartphone/home/index` I want to do this because I...

8 Oct at 09:21

AutoMapper throwing "No default constructor" during validation

I have classes to map, but they don't have default constructors, and I don't want them to have. This is because I only map to/from already existing objects. ``` public class Order { public string...

25 Apr at 09:37

Split by '/' till '[' appears

I want to split the following kind of string: > Parent/Child/Value [4za] AX/BY and get create a `String[]` out of it via: ``` String[] ArrayVar = Regex.Split(stringVar, "?"); ``` which split the stri...

20 Jun at 09:12

object initialization can be simplified

With my code I get 3 messages all saying `object initialization can be simplified` and in my ever growing thirst for knowledge (and my OCD) I would like to "fix" my code so that these messages dont ap...

25 Apr at 09:1

in ASP.NET Core, is there any way to set up middleware from Program.cs?

I am building a support library for ASP.NET Core websites. I have a few pieces of middleware that need to be enabled, and they need to be added before any other middleware due what they do. I can cr...

25 Apr at 06:59

How do I set `OutputPath` in a Visual Studio 2017 project (new .csproj file format) without the target framework cluttering the resolved path?

Setting `OutputPath` in the new Visual Studio 2017 project format automatically adds the target framework in the path. For example, if I have these set in the project file: ``` <TargetFramework>net46...

21 Jul at 21:53

Component is part of the declaration of 2 modules

I try to build an ionic 2 app. When I try the app in the browser with ionic serve or launch it on an emulator everything works fine. But when I try to build it every time the error ``` ionic-app-scrip...

Alternatives for updating mesh collider in runtime?

I'm working on game where user generating mesh in runtime (all the time) so mesh have many vertices and in the same time there is a GameObject - player that need to trigger event when it is in area of...

27 Apr at 19:43

Error occurred during the pre-login handshake

In a project that I am debugging I receive a SqlException saying the following: > Additional information: A connection was successfully established with the server, but then an error occurred durin...

How to change python version in anaconda spyder

I am using 3.6 Python version in anaconda spyder on my mac. But I want to change it to Python 2.7. Can any one tell me how to do that?

12 Jun at 18:39

Replace service registration in ASP.NET Core built-in DI container?

Let us consider a service registration in `Startup.ConfigureServices`: ``` public void ConfigureServices(IServiceCollection services) { services.AddTransient<IFoo, FooA>(); } ``` Is it possible...

Load XDocument asynchronously

I want to load large XML documents into XDocument objects. The simple synchronous approach using `XDocument.Load(path, loadOptions)` works great, but blocks for an uncomfortably long time in a GUI con...

WMV streaming file size limit

I have a windows media player embedded in my web page view: ``` <div id="divCourseVideo" style="width:100%;margin:0 auto;" class="container"> <OBJECT style="display:inline-block" ID="CoursePl...

7 Jul at 13:10

Retrieve the names of all the boolean properties of a class which are true

I have a class that has lots of bool properties. How can I create another property that is a list of strings that contains the name of the properties which have a value of true? See initial attempt b...

24 Apr at 13:0

Jenkins pipeline if else not working

I am creating a sample jenkins pipeline, here is the code. ``` pipeline { agent any stages { stage('test') { steps { sh 'echo hello' } ...

24 Apr at 12:21