Skip to content

Instantly share code, notes, and snippets.

View aramkoukia's full-sized avatar
🏠
Working from home

Aram Koukia aramkoukia

🏠
Working from home
View GitHub Profile
@aramkoukia
aramkoukia / Product.cs
Created January 20, 2018 23:07
Product Domain Class
using System;
using Products.Common.Events;
using MicroServices.Common;
namespace Products.Service.MicroServices.Products.Domain
{
public class Product : Aggregate
{
private Product() { }
@aramkoukia
aramkoukia / productCommandHandlers.cs
Created January 20, 2018 22:42
Product Command Handlers
using System;
using Products.Common.Dto;
using Products.Service.MicroServices.Products.Commands;
using MicroServices.Common.Repository;
namespace Products.Service.MicroServices.Products.Handlers
{
public class ProductCommandHandlers
{
private readonly IRepository repository;
@aramkoukia
aramkoukia / ProductCommands.cs
Created January 20, 2018 22:36
Product Commands
using System;
using MicroServices.Common;
namespace Products.Service.MicroServices.Products.Commands
{
public class CreateProduct : ICommand
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public string Description { get; private set; }
@aramkoukia
aramkoukia / ProductsController.cs
Created January 20, 2018 22:31
Products Controller
using System;
using System.Web.Http;
using System.Net;
using System.Net.Http;
using Products.Service.DataTransferObjects.Commands;
using Products.Service.MicroServices.Products.Commands;
using Products.Service.MicroServices.Products.Handlers;
using MicroServices.Common.Exceptions;
namespace Products.Service.Controllers
@aramkoukia
aramkoukia / IUserRepository.cs
Created January 7, 2018 00:45
User Repository Interface
using System.Collections.Generic;
namespace CachingAspectOrientedImplemetation
{
public interface IUserRepository
{
[Cache("key")]
IEnumerable<string> GetUsers();
string GetUsers(string id);
using CacheManager.Core;
using System;
using Unity.Interception.PolicyInjection.Pipeline;
namespace CachingAspectOrientedImplemetation
{
public class InvalidateCacheAttributeHandler : ICallHandler
{
private BaseCacheManager<object> _cache;
using System;
using Unity;
using Unity.Interception.PolicyInjection.Pipeline;
using Unity.Interception.PolicyInjection.Policies;
namespace CachingAspectOrientedImplemetation
{
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public class InvalidateCacheAttribute : HandlerAttribute
{
@aramkoukia
aramkoukia / UserRepository.cs
Created January 6, 2018 23:57
User Repository
using System.Collections.Generic;
namespace CachingAspectOrientedImplemetation
{
public class UserRepository : IUserRepository
{
[Cache("key")]
public IEnumerable<string> GetUsers()
{
return new string[] { "User 1", "User 2" };
@aramkoukia
aramkoukia / CacheAttributeHandler.cs
Created January 6, 2018 23:52
Cache Attribute Handler
using CacheManager.Core;
using System;
using Unity.Interception.PolicyInjection.Pipeline;
namespace CachingAspectOrientedImplemetation
{
public class CacheAttributeHandler : ICallHandler
{
private BaseCacheManager<object> _cache;
@aramkoukia
aramkoukia / CacheAttribute.cs
Created January 6, 2018 23:49
Cache Attribute
using System;
using Unity;
using Unity.Interception.PolicyInjection.Pipeline;
using Unity.Interception.PolicyInjection.Policies;
namespace CachingAspectOrientedImplemetation
{
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public class CacheAttribute : HandlerAttribute
{