Skip to content

Instantly share code, notes, and snippets.

💭
keep goin

Jack Jack85

💭
keep goin
  • Vienna, Austria, Europe
Block or report user

Report or block Jack85

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Jack85
Jack85 / startup.cs
Last active Mar 18, 2019
.net startup singleton
View startup.cs
services.AddDbContextPool<dbContext>(options => options.UseSqlite(conn));
//.UseSqlServer(connection));
//with scoped
//services.AddScoped<DmServices>();
//with singleton
// services.AddSingleton<DmServices>(s =>
// new DmServices(new ProsperusContext(
// new DbContextOptionsBuilder<dbContext>().UseSqlite(conn).Options)));
services.AddSingleton<DmServices>(s =>
{
View mvc frombody convention
https://github.com/aspnet/Mvc/blob/a78f77afde003c4a3fcf5dd7b6dc13dd9c85f825/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiParameterConventionsApplicationModelConvention.cs
View gist:c9052f882e6227e1feac449aeb9aa4ce
dotnet core 2.1,
please use https://www.myget.org/feed/zeekoget/package/nuget/TextTemplating.Tools/2.2.1-alpha1
alternative tools
https://github.com/filipw/dotnet-script or https://github.com/daveaglick/Scripty
View ts test
groupBy(array: any[], property: string) {
return array.reduce((prev, next) => {
// If the group doesn't exist, create it
if(!prev[property]) { prev[property] = [next]; }
// Else, we push it in
else { prev[property].push(next); }
// Mandatory return
return prev;
}, {});
}
You can’t perform that action at this time.