Skip to content

Instantly share code, notes, and snippets.

Avatar

Giridhar Prakash giridharprakash

  • One View
  • Indiana
View GitHub Profile
@giridharprakash
giridharprakash / EmailBackgroundService.cs
Created Apr 6, 2020
dotnet core background hosted service with dependency injection and runs every 5 seconds
View EmailBackgroundService.cs
public class EmailBackgroundService : BackgroundService
{
private readonly IServiceProvider _serviceProvider;
private readonly ILogger<EmailBackgroundService> _logger;
public EmailBackgroundService(IServiceProvider serviceProvider, ILogger<EmailBackgroundService> logger)
{
_serviceProvider = serviceProvider;
_logger = logger;
}
View ef-core-override-conventions
public static IServiceCollection InitDatabaseContext(this IServiceCollection services, string connectionString)
{
services.AddDbContext<AppDbContext>(opts =>
{
opts.UseSqlServer(connectionString);
opts.ReplaceService<IConventionSetBuilder, CustomSetBuilder>();
});
return services;
}
@giridharprakash
giridharprakash / code-coverage.js
Created Dec 20, 2019
Code coverage script for .net core projects
View code-coverage.js
var commandExists = require('command-exists');
const execSync = require('child_process').execSync;
const rimraf = require('rimraf');
function runCoverageReport() {
console.log('started code coverage');
rimraf.sync('TestResults');
let result = execSync('dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./TestResults/');
console.log(result.toString());
console.log('finished code coverage');
@giridharprakash
giridharprakash / documentViewer.ts
Created Aug 21, 2017
Load pdf stream and show it in ionic app.
View documentViewer.ts
import {File} from '@ionic-native/file';
import { DocumentViewer } from '@ionic-native/document-viewer';
export class DocumentViewer
{
constructor(private file : File, private documentViewer: DocumentViewer)
{
}
public openDocument(document: Document)
@giridharprakash
giridharprakash / service.ts
Last active Aug 18, 2017
Send JSON in Http Get request with Angular.
View service.ts
import {Http, Headers, RequestOptions, Response, ResponseContentType, URLSearchParams} from "@angular/http";
@Injectable()
export class DocumentService
{
constructor(private http: Http)
{
}
loadDocuments(folderId: number, currentPage: number) : Observable<Response>
@giridharprakash
giridharprakash / Program.cs
Last active Apr 14, 2017
Save xml content in Sql Server using entity framework
View Program.cs
namespace EntityFrameworkXmlDemo
{
internal class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Welcome");
bool retrieve = true;
var context = new SampleContext("connection string here");
@giridharprakash
giridharprakash / web.config
Created Feb 14, 2017
deploy node web application to IIS. this is blog post
View web.config
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="server/index.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="sample">
<match url="api/*" />
@giridharprakash
giridharprakash / web.config
Created Feb 14, 2017
node web application deployment to IIS. this is for blog post.
View web.config
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="sample">
<match url="/*" />
@giridharprakash
giridharprakash / introrx.md
Created Apr 15, 2016 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md