This file contains hidden or 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; | |
using Products.Common.Events; | |
using MicroServices.Common; | |
namespace Products.Service.MicroServices.Products.Domain | |
{ | |
public class Product : Aggregate | |
{ | |
private Product() { } |
This file contains hidden or 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; | |
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; |
This file contains hidden or 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; | |
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; } |
This file contains hidden or 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; | |
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 |
This file contains hidden or 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.Collections.Generic; | |
namespace CachingAspectOrientedImplemetation | |
{ | |
public interface IUserRepository | |
{ | |
[Cache("key")] | |
IEnumerable<string> GetUsers(); | |
string GetUsers(string id); |
This file contains hidden or 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 CacheManager.Core; | |
using System; | |
using Unity.Interception.PolicyInjection.Pipeline; | |
namespace CachingAspectOrientedImplemetation | |
{ | |
public class InvalidateCacheAttributeHandler : ICallHandler | |
{ | |
private BaseCacheManager<object> _cache; |
This file contains hidden or 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; | |
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 | |
{ |
This file contains hidden or 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.Collections.Generic; | |
namespace CachingAspectOrientedImplemetation | |
{ | |
public class UserRepository : IUserRepository | |
{ | |
[Cache("key")] | |
public IEnumerable<string> GetUsers() | |
{ | |
return new string[] { "User 1", "User 2" }; |
This file contains hidden or 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 CacheManager.Core; | |
using System; | |
using Unity.Interception.PolicyInjection.Pipeline; | |
namespace CachingAspectOrientedImplemetation | |
{ | |
public class CacheAttributeHandler : ICallHandler | |
{ | |
private BaseCacheManager<object> _cache; |
This file contains hidden or 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; | |
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 | |
{ |