This file contains hidden or 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
// For example classes generated by adding a reference to a WCF service. | |
// IEnumerable and arrays are tricky to serialize to xml, so here is the tip. | |
// First, I build a dictionary and put xml serialiers instance like this: | |
// _xmlSerializers.Add(typeof(SomeType), new XmlSerializer(typeof(SomeType), "a namespace")); | |
// _xmlSerializers.Add(typeof(List<SomeType>), new XmlSerializer(typeof(List<SomeType>), "a namespace")); | |
// Then te code to serialize a class: | |
string serialized = null; | |
bool serializerFound = false; | |
using (var xwriter = new Utf8StringWriter()) |
This file contains hidden or 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
// Thanks to : https://www.dotnetcurry.com/aspnet-mvc/1261/custom-model-binder-aspnet-mvc | |
// and https://docs.microsoft.com/en-us/aspnet/core/mvc/advanced/custom-model-binding?view=aspnetcore-2.2 | |
// model binder | |
public class SmartXmlModelBinder : IModelBinder | |
{ | |
public Task BindModelAsync(ModelBindingContext bindingContext) | |
{ | |
try | |
{ |
This file contains hidden or 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
"workbench.colorCustomizations": { | |
"statusBar.background": "#666666", | |
"titleBar.activeBackground": "#252526", | |
"statusBar.foreground": "#ffffff", | |
"statusBarItem.hoverBackground": "#dbd805a4", | |
"editor.lineHighlightBorder": "#363636", | |
"editor.lineHighlightBackground": "#363636", | |
"activityBar.background": "#007ACC", | |
"activityBar.border": "#003c64", | |
"activityBarBadge.foreground": "#ffffff", |
This file contains hidden or 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
https://github.com/aspnet/Security/issues/1469 | |
JWT token if any in request header, then OpenIdConnect (Azure AD) or anything else. | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
// Add CORS | |
services.AddCors(); | |
// Add authentication before adding MVC |
This file contains hidden or 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
export default Vue.extend({ | |
name: 'app', | |
created: function() { | |
// Add an utility method to check token on startup | |
// because the necessary renewal when expired etc isn't handled for now by vue-adal package. | |
// (see a comment in https://github.com/survirtual/vue-adal/issues/2). | |
const resource = AuthenticationContext.config.clientId | |
AuthenticationContext.acquireToken(resource, (err: any, token: any) => { | |
if (err) { | |
let errCode = err.split(':')[0] |
This file contains hidden or 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
Better Comments | |
Viasfora | |
Whack Whack Terminal | |
VSColorOutput ou Output enhancer | |
SQLite/SQL Server Compact Toolbox | |
JSON Viewer | |
Vue.js Pack 2017 | |
Trailling White Space | |
Local History for Visual Studio | |
Bundler & Minifier |
This file contains hidden or 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
<template> | |
<div v-if="isAuthenticated" id="app" class="container-fluid"> | |
<div id="mainTitle"> | |
Hello World | |
</div> | |
<router-view/> | |
</div> | |
</template> |
This file contains hidden or 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
modelBuilder_.Entity<User>() .HasMany(e => e.UserRoles) .WithOne() .HasForeignKey(e => e.UserId) .IsRequired() .OnDelete(DeleteBehavior.Cascade); | |
modelBuilder_.Entity<User>() .HasMany(e => e.UserRoles) .WithOne() .HasForeignKey(e => e.RoleId) .IsRequired() .OnDelete(DeleteBehavior.Cascade); | |
modelBuilder_.Entity<Role>() .HasMany(e => e.UserRoles) .WithOne() .HasForeignKey(e => e.RoleId) .IsRequired() .OnDelete(DeleteBehavior.Cascade); | |
modelBuilder_.Entity<User>() .HasMany(e => e.UserLogins) .WithOne() .HasForeignKey(e => e.UserId) .IsRequired() .OnDelete(DeleteBehavior.Cascade); | |
modelBuilder_.Entity<User>() .HasMany(e => e.UserTokens) .Wit |
This file contains hidden or 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
Param( | |
[string]$projectPath=$(throw "projectPath is required (full path to .csproj file)"), | |
[string]$packageName=$(throw "packageName is required"), | |
[string]$configurationDirName=$(throw "configurationDirName is required"), | |
[string]$keyAlias=$(throw "keyAlias is required (keystore key alias)") | |
) | |
# Parameters are defined at first line of powershell script. | |
# Thanks to http://docs.xamarin.com/guides/android/deployment%2C_testing%2C_and_metrics/publishing_an_application/part_1_-_preparing_an_application_for_release for this script | |
# Parameters : |