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 Awesome.Api.Data; | |
namespace Awesome.Api.Controllers; | |
public abstract partial class TodoController | |
{ | |
} | |
public class CustomTodoController : TodoController | |
{ |
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 Microsoft.AspNetCore.Mvc; | |
namespace Awesome.Api.Controllers; | |
public partial class TodoController | |
{ | |
[HttpPut("mark-all-as-completed")] | |
public async Task MarkAllAsCompletedAsync() | |
{ | |
var todos = await _repository.GetListAsync(); |
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 Humanizer; | |
using Microsoft.Extensions.Options; | |
using MongoDB.Driver; | |
using MongoDB.Driver.Linq; | |
namespace Awesome.Api.Data; | |
public class MongoDbRepository<TModel> : IRepository<TModel> | |
where TModel : class, IIdentifiable | |
{ |
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
namespace Awesome.Api.Data; | |
public interface IRepository<TModel> | |
where TModel : class, IIdentifiable | |
{ | |
Task<List<TModel>> GetListAsync(); | |
Task<TModel> GetSingleAsync(Guid id); | |
Task InsertAsync(TModel model); |
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 Awesome.Generators.Templates; | |
using Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp; | |
using Microsoft.CodeAnalysis.Text; | |
using System.Text; | |
namespace Awesome.Generators; | |
[Generator] | |
public class ServiceGenerator : ISourceGenerator |
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 Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp.Syntax; | |
namespace Awesome.Generators; | |
public class AttributeSyntaxReceiver<TAttribute> : ISyntaxReceiver | |
where TAttribute : Attribute | |
{ | |
public IList<ClassDeclarationSyntax> Classes { get; } = new List<ClassDeclarationSyntax>(); |
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 DotNurse.CodeAnalysis.Extensions; | |
using Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp.Syntax; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace DotNurse.CodeAnalysis; | |
public class AttributeSyntaxReceiver<TAttribute> : ISyntaxReceiver |
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
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFrameworks>net5.0;net6.0</TargetFrameworks> | |
<PackAsTool>true</PackAsTool> | |
<ToolCommandName>myawesomeapp</ToolCommandName> | |
</PropertyGroup> | |
</Project> |
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
[HttpGet] | |
public IEnumerable<WeatherForecast> Get([FromQuery]WeatherForecastFilter filter) | |
{ | |
var rng = new Random(); | |
// Change range to 100 from 5 to get more reasonable results. | |
return Enumerable.Range(1, 100).Select(index => new WeatherForecast | |
{ | |
Date = DateTime.Now.AddDays(index), | |
TemperatureC = rng.Next(-20, 55), | |
Summary = Summaries[rng.Next(Summaries.Length)] |
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; | |
namespace MyAwesomeApp | |
{ | |
[GenerateAutoFilter] // <-- Add this attribute | |
public class WeatherForecast | |
{ | |
public DateTime Date { get; set; } | |
public int TemperatureC { get; set; } |
NewerOlder