Skip to content

Instantly share code, notes, and snippets.

View thiagoloureiro's full-sized avatar
🚗
Coding

Thiago thiagoloureiro

🚗
Coding
View GitHub Profile
using System.Threading.Tasks;
using Orleans;
namespace ConverterContracts
{
/// <summary>
/// Grain interface IConverter
/// </summary>
public interface IConverter : IGrainWithGuidKey
{
<ItemGroup>
<PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.0" />
</ItemGroup>
using BenchmarkDotNet.Attributes;
using System.Collections.Generic;
namespace BenchNET
{
public class Iterate
{
private List<string> lstStr;
private int Counter;
using BenchmarkDotNet.Running;
using System;
namespace BenchNET
{
internal class Program
{
private static void Main(string[] args)
{
var summary = BenchmarkRunner.Run<Iterate>();
[HttpPost]
[ModelStateValidationActionFilter]
public IHttpActionResult Post(object model)
{
// Do something here ;)
}
public class ModelStateValidationActionFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext actionContext)
{
var modelState = actionContext.ModelState;
if (!modelState.IsValid)
actionContext.Response = actionContext.Request
.CreateErrorResponse(HttpStatusCode.BadRequest, modelState);
}
public class CustomerService
{
[CacheableResult(600)] // 600 seconds, 10 minutes cache policy
public List<dynamic> ReturnCustomer()
{
var lstCustomer = new List<dynamic>();
var customer = new Customer
{
Id = 1,
public class CustomerController : NancyModule
{
public CustomerController() : base("/customers")
{
try
{
var obj = new CustomerService();
Get["/"] = _ =>
{
private static void Main(string[] args)
{
Console.WriteLine("Starting NancyFX...");
using (var nancyHost = new NancyHost(new Uri("http://localhost:8889/nancy/")))
{
nancyHost.Start();
Console.WriteLine("Nancy now listening - navigating to http://localhost:8889/nancy/. Press enter to stop");
Console.ReadLine();
}
}