Questions

Is there a TypeScript equivalent to C#'s attributes

In C# there is a syntax available to define attributes of a property. ``` [Required] string personName ``` It describes that personName is required. We can get the attributes of a property in any g...

20 Feb at 11:11

How can I implement a transaction for my repositories with Entity Framework?

I am trying to utilize the repository design pattern in my application for 2 reasons 1. I like to de-couple my application from Entity in case I decide to not use Entity Framework at some point 2. I...

Can I write PowerShell binary cmdlet with .NET Core?

I'm trying to create a basic PowerShell Module with a binary Cmdlet internals, cause writing things in PowerShell only doesn't look as convenient as in C#. Following [this](https://msdn.microsoft.com...

Using CustomCredentialsAuthProvider in JsonServiceClient

I try to implement my own custom CredentialsAuthProvider. The server seems to work fine with the following implementation: ``` public class MyCustomCredentialsAuthProvider : CredentialsAuthProvider {...

6 Oct at 20:1

How to create a password protected database?

I am trying to create a password protected SQLite database to use within a WPF application using Entity Framework Core. I know how to generate DbContext and Entities from an existing database but don'...

20 Nov at 15:19

How to clear specific TempData

How to clear specific TempData in asp.net mvc. I am using more than two `TempData` var. I can to clear specific some of them. ```csharp TempData["USD"] = "updated"; TempData["EUR"] = "updated"; ...

3 May at 18:34

How to combine TaskCompletionSource and CancellationTokenSource?

I have such code (simplified here) which awaits finishing task: ``` var task_completion_source = new TaskCompletionSource<bool>(); observable.Subscribe(b => { if (b) task_comple...

Plugin with id 'com.google.gms.google-services' not found

I have followed this [link](https://firebase.google.com/docs/admob/android/quick-start) to integrate ads in my app. But it shows this error: ![error image](https://i.stack.imgur.com/V1RZN.png) This ...

22 Jul at 20:37

Enumerable.Empty<T>() equivalent for IList?

In some case I've to return an empty list of items in a method. Most of the case, I'm returning an `IEnumerable<T>`, so the `Enumerable.Empty<T>()` does exactly the job. But I've one case where I've ...

6 Oct at 10:9

Summary on async (void) Method: What to return?

This is maybe a trivial question but currently im doing some Inline-Documentation for future Coworkers and stumbled upon something like that: ``` /// <summary> /// This Class is totaly useless /// </...

6 Oct at 06:15

How to get height and width of device display in angular2 using typescript?

I found this solution. Is it valid? ``` import {Component} from '@angular/core'; import {Platform} from 'ionic-angular'; @Component({...}) export MyApp { constructor(platform: Platform) { platform...

31 Aug at 13:43

How do I Access Buttons inside a UserControl from xaml?

At work I have several pages, each with buttons in the same places, and with the same properties. Each page also has minor differences. To that end, we created a userControl Template and put all the b...

Javascript How to get first three characters of a string

This may duplicate with previous topics but I can't find what I really need. I want to get a first three characters of a string. For example: ``` var str = '012123'; console.info(str.substring(0,3))...

6 Apr at 15:45

JavaScript spread syntax in C#

Is there any implementation in C# like [JavaScript's spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)? ``` var arr = new []{ "1", "2"//....

10 Feb at 05:17

"Duplicate entry for key primary" on one machine but not another, with same data?

My issue: inserting a set of data works on my local machine/MySQL database, but on production it causes a `Duplicate entry for key 'PRIMARY'` error. As far as I can tell both setups are equivalent. ...

1 Nov at 13:16

How should StackExchange.Redis IDatabase object be used in a multi-threaded application?

I'm getting mixed messages from the StackExchange.Redis documentation about how to use an IDatabase. In the [Basic Usage doc](https://github.com/StackExchange/StackExchange.Redis/blob/master/Docs/Bas...

5 Oct at 22:11

How to break out from foreach loop in javascript

I am newbie in Javascrript. I have a variable having following details: ``` var result = false; [{"a": "1","b": null},{"a": "2","b": 5}].forEach(function(call){ console.log(call); var a = cal...

5 Oct at 20:14

C# Download the sound of a youtube video

I can download a video from youtube but I want the sound only. How can I do that? Code I have for downloading the video (Using VideoLibrary): ``` YouTube youtube = YouTube.Default; Video vid...

5 Oct at 15:17

Attaching a debugger to code running in another app domain programmatically

I am working on a Visual Studio extension and one of it's functions creates a new app domain and load an assembly into that app domain. Then it runs some functions in the app domain. What I'd like to ...

5 Oct at 19:39

Should I call SaveChanges once or after each change?

I need to make several changes in my database in my controller. ``` foreach (var valueStream in model.ListValueStream) { ValueStreamProduct vsp = new ValueStreamProduct(valueStream.Id, product.Id)...

How to get the URL of the current window using Selenium WebDriver in C#?

In my application when sign-in, then it navigates to another page. Now I need to get that new URL using WebDriver in selenium C#. I can't find any function to do this. I have tried `driver.Url`, `dr...

23 Jul at 06:28

Dynamic string interpolation

Can anyone help me with this? Required Output: "" ``` class Program { static void Main(string[] args) { Console.WriteLine(ReplaceMacro("{job.Name} job for admin", new Job { Id = 1, N...

6 Oct at 16:13

Servicestack Razor transforms sections into a nameless method (and throws errors)

I got the razor view engine working in my mvc application. first it threw an error the viewpage should inherit from the mvc.WebPageBase. I made my own viewpage that inherits from mvc.WebViewPage. (So...

Can't provide NuGet package source credentials to Azure Function

I have an Azure function which has a dependency on a private package feed. I am copying a `nuget.config` file to the app service which looks like this: ``` <?xml version="1.0" encoding="utf-8"?> <conf...

Accessing responseDTO type in HandleException of custom ServiceRunner in ServiceStack

I have written custom ServiceRunner and overridden the HandleException method. As I can see, in case of an unhandled exception within a service the object returned by the HandleException method become...

12 Oct at 05:11