View gist:d7f6533e12e5f7e1c0fc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net.Http.Formatting; | |
using System.Runtime.Serialization; | |
using Newtonsoft.Json; | |
using WebApiContrib.Formatting; | |
namespace WebApiContrib | |
{ | |
public static class SerializationHelper | |
{ |
View gist:4cac4f4dae2b22e45ec4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DbContextExtensions | |
{ | |
public static void LogToConsole(this DbContext context) | |
{ | |
IServiceProvider contextServices = ((IDbContextServices)context).ScopedServiceProvider; | |
var loggerFactory = contextServices.GetRequiredService<ILoggerFactory>(); | |
loggerFactory.AddConsole(LogLevel.Verbose); | |
} | |
} |
View .gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build and package folders | |
################### | |
build | |
dist | |
packages | |
typings | |
.tmp | |
# System folders | |
################### |
View git-add-remote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sets the new remote | |
git remote add origin <remote repository URL> | |
# Verifies the new remote URL | |
git remote -v | |
# Pushes the changes | |
git push origin master |
View Startup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) | |
{ | |
// Set up configuration sources ... | |
// Set up data directory | |
string appRoot = appEnv.ApplicationBasePath; | |
AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(appRoot, "App_Data")); | |
} |
View NorthwindSlim.Connections.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<connectionStrings> | |
<!--<add name="NorthwindSlimContext" connectionString="Data Source=.\sqlexpress;Initial Catalog=NorthwindSlim;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />--> | |
<add name="NorthwindSlimContext" connectionString="Data Source=(localdb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\NorthwindSlim.mdf;Integrated Security=True" providerName="System.Data.SqlClient" /> | |
</connectionStrings> |
View FakeProductRepository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using HelloMvcWithDI.Entities; | |
using HelloMvcWithDI.Patterns; | |
namespace HelloMvcWithDI.Tests | |
{ | |
public class FakeProductRepository : IProductRepository | |
{ | |
private List<Product> _products = new List<Product> |
View Mac OS X: Open in Visual Studio Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Open Automator | |
- File -> New -> Service | |
- Change "Service Receives" to "files or folders" in "Finder" | |
- Add a "Run Shell Script" action | |
- Change "Pass input" to "as arguments" | |
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*" | |
- Save it as something like "Open in Visual Studio Code" |
View keybindings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ "key": "shift+cmd+g", "command": "workbench.view.git" }, | |
{ "key": "shift+cmd+x", "command": "workbench.action.tasks.terminate" }, | |
{ "key": "cmd+.", "command": "editor.action.quickFix", "when": "editorTextFocus" } | |
] |
View settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your settings in this file to overwrite the default settings | |
{ | |
"window.reopenFolders": "none", | |
"editor.fontSize": 15 | |
} |
OlderNewer