Questions

ASP.NET Core RC2 Seed Database

My problem is i am trying to seed an Entity Framework Core database with data and in my mind the below code show work. I've realised that this should not be called in the `ApplicationDbContext` constr...

Mapping foreign key to non primary surrogate key column in EF code first

``` public class A { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public virtual int Aid { get; set; } public virtual ICollection<B> B { get; set; } } public cla...

What is the difference between Authorize Action filter and Authorization filter?

As per the [ASP.NET website](http://www.asp.net/mvc/overview/older-versions-1/controllers-and-routing/understanding-action-filters-cs) The ASP.NET MVC framework includes several action filters: 1. ...

25 Jun at 13:35

Best practice for error handling with ASP.NET Web API

Could you clarify what is the best practice with Web API error management. Actually, I don't know if it is a good practice to use try catch into my Api request. ``` public Vb.Order PostOrderItem(Vb.O...

13 Jan at 16:55

ServiceStack in Xamarin

I'm having a werid issue with the recent updates. I'm Using Visual Studio Enterprise 2015 and XF 2.3 I'm using Service Stack, and everything works cool but here's when the story goes werid. I have a...

Navigating through dynamic Object (json) in C#

i'm getting a json from a HTTP GET request that looks like after parsing it with "NewtonSoft.Json": Where responseString is : As you see, the name changes everytime, and i was wondering how do I navig...

17 Jul at 08:45

Implementing Application only API key and secret in servicestack with additional user api keys

So, I'm trying to figure out the best way to implement the following authentication in my ServiceStack api. I want to secure all API calls such that they are only available to applications we define ...

24 Jun at 18:0

"async Task then await Task" vs "Task then return task"

Quick question.. In order to get some solid base understanding about Asynchronous Programming and the `await` I would like to know what the difference is between these two code snippets when it comes...

10 Dec at 10:7

When is it appropriate to use the extern keyword without using the [DllImport] attribute?

I was re-reading through some .Net documentation today when I noticed that the first portion of the [extern keywords documentation](https://msdn.microsoft.com/en-us/library/e59b22c5.aspx) claims: > T...

24 Jun at 13:59

Error handling (Sending ex.Message to the client)

I have an ASP.NET Core 1.0 Web API application and trying to figure out how to pass the exception message to the client if a function that my controller is calling errors out. I have tried so many th...

Can I use ServiceStack in two different .NET MVC sites running in a shared environment on Sitecore?

We are delivering an ASP.NET MVC application built with Sitecore to a client that deploys the application to a multi site/tenant Sitecore installation. We make heavy use of ServiceStack as we do on m...

24 Jun at 11:6

Generic Type Converter - TypeConverter or Convert.ChangeType

I am trying to convert from a String a a generic type. The generic type will be an Int32, Int64, Boolean, Double and so on ... I tried two approaches: ``` public static Boolean TryParse<T>(String sou...

24 Jun at 11:4

Excel 2016 triggers undo upon save bug?

Excel 2016 seems to trigger a programmatically added undo level upon saving, which does not happen in earlier versions of Excel (2013, 2010, and 2007). To reproduce this apparent bug, open a new workb...

28 Jun at 11:2

ObjectDisposedException: The CancellationTokenSource has been disposed

I'm starting to develop with Xamarin.Forms using Xamarin Studio on my MacBook Pro. I built an application whose purpose is to query a PrestaShop Website, retrieve the Products and show them. When depl...

17 Jul at 08:46

How insert enum as int in DynamoDb with ServiceStack.Aws

i have a model that has a enum property and i need save this model with this property in DynamoDb, but as integer rather than string (default behavior in ServiceStack.Aws). In ServiceStack.DataAnnota...

24 Jun at 00:55

Hide web method services in webconfig or in deployment

I have a .net webservice solution with several webmethods exposed. I need to deliver two deployments with this solution. One with all the methods exposed and other with some of those methods hidden. ...

23 Jun at 20:1

How to determine at runtime the accept type in a ServiceStack request

I'm using ServiceStack to wrap a component that only returns xml or json (as string) and am wondering how I can differentiate in my service code whether to call the toJson() or toXml() methods of the ...

23 Jun at 19:15

Error when trying to inject a service into an angular component "EXCEPTION: Can't resolve all parameters for component", why?

I've built a basic app in Angular, but I have encountered a strange issue where I cannot inject a service into one of my components. It injects fine into any of the three other components I have creat...

ServiceStack Service startup error

I am using the below code but I am getting error on this line `appHost.Start(listeningOn)`. I deleted bin and obj folders, and even restarted Visual Studio, but the error persists: Here is the code...

23 Jun at 18:20

Entity Framework entity is not in DataSpace.OSpace (_workspace.GetItemCollection(DataSpace.OSpace)) but is in DataSpace.CSpace

I have been mucking around with `XML`s for entity Framework. I tried to create a type of entity that could have properties injected at runtime, First I created `DynamicEntity` object that is dynamic ...

how do a conditional write in dynamodb with ServiceStack.Aws

In dynamodb, you can do a conditional write (see [here](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.ConditionalUpdate) and [here](http://docs...

How can I remove duplicate lines in Visual Studio Code?

Say you have the following text: ``` abc 123 abc 456 789 abc abc ``` I want to remove all "abc" lines and just keep one. I don't mind sorting. The result should be like this: ``` abc 123 456 789 `...

9 Jun at 12:25

Config your IIS server to use the "Content-Security-Policy" header

I need to add custom headers in IIS for "Content-Security-Policy", "X-Content-Type-Options" and "X-XSS-Protection". I get the procedure to add these headers but i am not sure what should be the valu...

23 Jun at 12:53

Gradle Sync failed could not find constraint-layout:1.0.0-alpha2

``` Error:Could not find com.android.support.constraint:constraint-layout:1.0.0-alpha2. Required by: myapp:app:unspecified ``` Android Studio 2.2 P 1

Passing a variable from node.js to html

I am trying to pass a variable from node.js to my HTML file. ``` app.get('/main', function(req, res) { var name = 'hello'; res.render(__dirname + "/views/layouts/main.html", {name:name}); }); ```...

15 Mar at 15:56