Questions

Why use Attach for update Entity Framework 6?

While searching for the best practivies of performing CRUD operation via EF I noticed that it is highly recommended to use `Attach()` or `Find()` methods before updating an entity. It works well and a...

7 Dec at 19:9

Is there a way to check if a mock has setup for a member?

I have a need for doing: ``` if(!fooMock.HasSetupFor(x => x.Bar)) { fooMock.Setup(...); } ``` Above is pseudocode and it is the equivalent of `HasSetupFor` I'm looking for. Is this possible?

7 Dec at 15:24

Visual Studio 2015 - "Unable to step. The operation could not be completed. A retry should be performed"

When debugging I get the following error: > Unable to step. The operation could not be completed. A retry should be performed After clicking OK, the dialog returns: > The debugger cannot continue...

28 Dec at 12:34

ASP.NET MVC Core how to get application supported culture list

In my Startup.cs I added two cultures: ``` var cultureLt = new CultureInfo("LT"); var cultureEn = new CultureInfo("EN"); var supportedCultures = new List<CultureInfo> {cultureEn, cultur...

7 Dec at 12:43

Accessing Certificate from within a C# Azure function

I need to access a certificate from my Azure Function. I followed the steps outlined in [Runtime error loading certificate in Azure Functions](https://stackoverflow.com/questions/40240195/runtime-er...

23 May at 12:33

How to generate controller using dotnetcore command line

In Ruby on Rails, you can generate controllers using something like the following in command line: `rails generate controller ControllerName action1 action2` `...etc` Is there something similar in t...

8 Apr at 23:57

Getting Scope Validating error in Identity Server 4 using JavaScript Client in asp.net core

I am getting the below error while making a request to my Identity Server application from my Javascript Client Application. I have made sure I add the scope in my Identity Server application. Bel...

Azure Functions: configure blob trigger only for new events

I have about 800k blobs in my azure storage. When I create azure function with a blobTrigger it starts to process all blobs that I have in the storage. How can I configure my function to be triggered ...

Forcing EventProcessorHost to re-deliver failed Azure Event Hub eventData's to IEventProcessor.ProcessEvents method

The application uses .NET 4.6.1 and the [Microsoft.Azure.ServiceBus.EventProcessorHost nuget package v2.0.2](https://www.nuget.org/packages/Microsoft.Azure.ServiceBus.EventProcessorHost/2.0.2/), along...

23 May at 12:2

How to configure Swashbuckle to ignore property on model

I'm using Swashbuckle to generate swagger documentation\UI for a webapi2 project. Our models are shared with some legacy interfaces so there are a couple of properties I want to ignore on the models....

Create a non-clustered index in Entity Framework Core

Using Entity Framework Core, I want to have a Guid PK, without suffering page [fragmentation](https://stackoverflow.com/a/14996125/852806) in the database. I have seen this [post](https://stackoverfl...

Visual Studio serialization error when T4 uses DTE to open generated file

We have a C# T4 file named GenerateProxies.tt which calls several command-line codegen utilities. Using the System.Diagnostics Process class, we redirect the standard output to the T4 output text file...

5 May at 13:38

Entity framework query on just added but not saved values

I'm using Entity Framework from a couple of years and I have a little problem now. I add an entity to my table, with ``` Entities.dbContext.MyTable.Add(obj1); ``` and here ok. Then, I'd like to m...

7 Dec at 07:25

What are the differences between Decorator, Wrapper and Adapter patterns?

I feel like I've been using these pattern families quite many times, however, for me it's hard to see the differences as their are quite similar. Basicaly it seems like all of them is about another ...

6 Dec at 13:0

Get relative Path of a file C#

I currently writing a project in visual studio in c#. the project full path is: ``` "C:\TFS\MySolution\" ``` I have a file that I need to load during the execution. lets say the file path is ``` "...

7 Sep at 13:8

How long Cookies last, which return with JsonServiceClient Request

I am working with Xamarin-Forms application.To authenticate user I use ServiceStack CredentialAuthProvider.When authentication successfully done I got cookieContainer in response.I want to know how lo...

How to get authenticated user's name, IP address, and the controller action being called from an HTTP Filter?

I'm trying to audit my action events on the controller. I want to keep track of authenticated user's name, his IP address, and controller action being called. My filter code: ```csharp public c...

3 May at 05:13

C# 6.0 multiple identical null conditional operator checks vs single traditional check

Which out of the following two equivalent ways would be best for the null conditional operator in terms of primarily performance and then ease of use or clarity etc.? This: ``` idString = child?.Id;...

6 Dec at 12:22

How to import CSV file with white-space in header with ServiceStack.Text

I am using ServiceStack.Text library for reading from CSV files in C#. I would like to know how to deserialize CSV to objects where CSV contains white space separated header ? I am using this code...

6 Dec at 06:31

Implementing recursive property loading in EF Core

I'm on .NET Core 1.1.0, EF Core 1.1.0, VS 2015. I'm writing a system for posts/comments, and I need a function to load a comment and all of its children and their associated properties. Here's a simpl...

Does SemaphoreSlim (.NET) prevent same thread from entering block?

I have read the docs for SemaphoreSlim [SemaphoreSlim MSDN](https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k(System.Threading.SemaphoreSlim);k(TargetFrameworkMoniker-.NETFrame...

Visual studio code auto-complete

I have just downloaded unity and saw that now it supports Visual studio code, I downloaded it and made it the default editor. After trying to edit a script, it prompted me to download c# extension an...

Invalid Hyperlink: Malformed URI is embedded as a hyperlink in the document

I'm using the OpenXml namespace in my application. I'm using this to read the XML within an Excel file. This works fine with certain excel files but on others I get a run time error saying > Invalid...

6 Dec at 09:3

IQueryable does not contain definition for GetAwaiter

I'm using WebAPI in entity framework to create a new endpoint and I am having some issues. I'm trying to use a Linq Where statement to get my data, but I'm receiving the following error. > 'IQueryab...

5 Dec at 19:1

Unable to load type from assembly (C# Amazon lambda function)

Since Amazon now supports C# to build AWS Lambda functions, i wanted to give it a try, but i get stuck when performing a test. This is my simple class: ``` using System; using System.IO; using Syste...