Skip to content

Instantly share code, notes, and snippets.

Derek Comartin dcomartin

Block or report user

Report or block dcomartin

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
View getservice.cs
var config = serviceProvider.GetService<IOptions<DemoConfig>>();
View startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace Aws.DataProtection.Demo
{
public class Startup
View config.cs
public class DemoConfig
{
public string TestItem { get; set; }
public DemoSubConfig SubConfig { get; set; }
}
public class DemoSubConfig
{
public string SubItem { get; set; }
}
View program.cs
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace Aws.DataProtection.Demo
{
public class Program
{
public static void Main(string[] args)
{
View startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace Aws.DataProtection.Demo
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
View startup.cs
using Amazon.S3;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace AspNetCore.Aws.Demo
{
public class Startup
View Program.cs
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace AspNetCore.Aws.Demo
{
public class Program
{
public static void Main(string[] args)
{
View appsetting.json
{
"AWS": {
"Profile": "default",
"Region": "us-west-2"
}
}
View dbContext.cs
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder
.Query<BlogPostsCount>().ToView("View_BlogPostCounts")
.Property(v => v.BlogName).HasColumnName("Name");
}
View model.cs
public class BlogPostsCount
{
public string BlogName { get; set; }
public int PostCount { get; set; }
}
You can’t perform that action at this time.