/// <summary> /// Constructor /// </summary> /// <param name="crudService">The persistence service that will actually create, read and update data.</param> /// <param name="options"></param> public CrudPersistenceHelper(ICrudable <TModelCreate, TModel, TId> crudService, CrudPersistenceHelperOptions options) { _readService = crudService as IRead <TModel, TId>; InternalContract.Require(_readService != null, $"Parameter {nameof(crudService)} must implement {nameof(IRead<TModel, TId>)}."); _crudService = crudService; _options = options; }
// private readonly YearsRepository yearsRepository; public LoanRepaymentsController() { loanRepaymentRepo = new LoanRepaymentRepository(); creditsRepsitory = new Creditsrepository(); monthRepository = new MonthRepository(); // yearsRepository = new YearsRepository(); }
/// <summary> /// Constructor for TOneModel that implements <see cref="IUniquelyIdentifiable{TId}"/>. /// </summary> /// <param name="service"></param> /// <param name="cache"></param> /// <param name="flushCacheDelegateAsync"></param> /// <param name="options"></param> public SlaveToMasterAutoCache(ICrudable service, IDistributedCache cache, FlushCacheDelegateAsync flushCacheDelegateAsync = null, AutoCacheOptions options = null) : this(service, item => ((IUniquelyIdentifiable <SlaveToMasterId <TId> >)item).Id, cache, flushCacheDelegateAsync, options) { }
public static void DoDbOperation(ICrudable x) { x.CreateDb(); x.ReadDb(); x.UpdateDb(); x.DeleteDb(); }
/// <summary> /// Constructor /// </summary> /// <param name="service"></param> /// <param name="symmetricEncryptionKey"></param> public CrudEncrypt(ICrudable <StorableAsByteArray <TModel, TId>, TId> service, byte[] symmetricEncryptionKey) : base(symmetricEncryptionKey) { InternalContract.RequireNotNull(service, nameof(service)); InternalContract.RequireNotNull(symmetricEncryptionKey, nameof(symmetricEncryptionKey)); _service = new CrudPassThrough <StorableAsByteArray <TModel, TId>, TId>(service); _convenience = new CrudConvenience <TModel, TModel, TId>(this); }
public static void DoDbOperation(ICrudable icrudable) { Console.WriteLine("In side DoDbOperation"); icrudable.Create(); icrudable.Read(); icrudable.Delete(); icrudable.Update(); }
public static void DoDbOpperation(ICrudable crudOp) { Console.WriteLine("Inside Db operation"); crudOp.Create(); crudOp.Read(); crudOp.Update(); crudOp.Delete(); }
public static void DoDbOperation(ICrudable crud) { Console.WriteLine("Doing db operations"); crud.Create(); crud.Read(); crud.Update(); crud.Delete(); }
public static void PrintInfo(ICrudable crudable) { crudable.Add(); crudable.Update(); crudable.Delete(); crudable.Read(); Console.WriteLine(); }
/// <summary> /// If <paramref name="service"/> doesn't implement <typeparamref name="T"/>, an exception is thrown. /// </summary> /// <param name="service">The service that must implement <typeparamref name="T"/>.</param> /// <typeparam name="T">The type that <paramref name="service"/> must implement.</typeparam> /// <returns></returns> /// <exception cref="FulcrumNotImplementedException">Thrown if <paramref name="service"/> doesn't implement <typeparamref name="T"/>.</exception> public static T GetImplementationOrThrow <T>(ICrudable service) where T : ICrudable { if (service is T implemented) { return(implemented); } throw new FulcrumNotImplementedException($"The service {service.GetType()} does not implement {typeof(T).Name}"); }
/// <summary> /// If <paramref name="service"/> doesn't implement <typeparamref name="T"/>, an exception is thrown. /// </summary> /// <param name="service">The service that must implement <typeparamref name="T"/>.</param> /// <typeparam name="T">The type that <paramref name="service"/> must implement.</typeparam> /// <returns></returns> /// <exception cref="FulcrumNotImplementedException">Thrown if <paramref name="service"/> doesn't implement <typeparamref name="T"/>.</exception> public static T GetImplementationOrThrow <T>(ICrudable service) where T : ICrudable { InternalContract.RequireNotNull(service, nameof(service)); if (service is T implemented) { return(implemented); } throw new FulcrumNotImplementedException( $"The service {service.GetType()} does not implement {typeof(T).Name}"); }
static void Main(string[] args) { Console.WriteLine("Hello World, I`m mapping!"); // Mapping example. var students = ICrudable.GetAll <Student>(); foreach (var student in students) { var viewModel = StudentViewModel.Map(student); Console.WriteLine($"{viewModel.UniqName} - {viewModel.AvgMark}"); } Console.ReadKey(); }
/// <inheritdoc /> public SlaveToMasterToServerTranslator(ICrudable <TModel, string> service, System.Func <string> getServerNameMethod, ITranslatorService translatorService) : base(service, getServerNameMethod, translatorService) { }
/// <inheritdoc /> public CrudClientTranslator(ICrudable service, string idConceptName, System.Func <string> getClientNameMethod, ITranslatorService translatorService) : base(service, idConceptName, getClientNameMethod, translatorService) { }
/// <summary> /// Constructor for TOneModel that does not implement <see cref="IUniquelyIdentifiable{TId}"/>, or when you want to specify your own GetKey() method. /// </summary> /// <param name="service"></param> /// <param name="cache"></param> /// <param name="getIdDelegate"></param> /// <param name="flushCacheDelegateAsync"></param> /// <param name="options"></param> public SlaveToMasterAutoCache(ICrudable service, GetIdDelegate <TManyModel, SlaveToMasterId <TId> > getIdDelegate, IDistributedCache cache, FlushCacheDelegateAsync flushCacheDelegateAsync = null, AutoCacheOptions options = null) : base(service, getIdDelegate, cache, flushCacheDelegateAsync, options) { }
/// <summary> /// Constructor /// </summary> /// <param name="service">The crud class to pass things down to.</param> public SlaveToMasterPassThrough(ICrudable service) : base(service) { }
public EmployeesController() { employeesrepository = new Employeerepository(); postionrepository = new Positionrepository(); }
/// <summary> /// Constructor /// </summary> /// <param name="service">The crud class to pass things down to.</param> public CrudPassThrough(ICrudable <TModel, TId> service) : base(service) { }
/// <inheritdoc /> public CrudSlaveToMasterControllerHelper(ICrudable <TModel, string> logic) : base(logic) { }
/// <summary> /// Constructor /// </summary> public SlaveToMasterMapper(ICrudable <TServerModel, TServerId> service, IMappable <TClientModel, TServerModel> mapper) : base(service, mapper) { }
public UnitOfMeasuresController() { unitsrepo = new UnitOfMeasurerepository(); }
/// <inheritdoc /> public CrudFromServerTranslator(ICrudable service, string idConceptName, System.Func <string> getServerNameMethod) : base(service, idConceptName, getServerNameMethod) { }
public IngredientsController() { ingredientsrepo = new Ingredientsrepository(); rawMaterialrepi = new RawMaterialsrepository(); finishedProductsrepo = new FinProductrepository(); }
/// <inheritdoc /> public SlaveToMasterClientTranslator(ICrudable <TModel, string> service, string masterIdConceptName, string slaveIdConceptName, System.Func <string> getClientNameMethod, ITranslatorService translatorService) : base(service, masterIdConceptName, slaveIdConceptName, getClientNameMethod, translatorService) { }
/// <inheritdoc /> public CrudController(ICrudable <TModel, string> logic) : base(logic) { }
/// <summary> /// Constructor /// </summary> public CrudManyToOneDefaultController(ICrudable <TModel, string> logic) : base(logic) { }
/// <inheritdoc /> public ManyToOneToServerTranslator(ICrudable <TModel, string> service, string idConceptName, System.Func <string> getServerNameMethod, ITranslatorService translatorService) : base(service, idConceptName, getServerNameMethod, translatorService) { }
public List <Mark> LoadMarks() => ICrudable.GetAll <Mark>(x => x.StudentId == Id).ToList();
/// <summary> /// Constructor for TModel that does not implement <see cref="IUniquelyIdentifiable{TId}"/>, or when you want to specify your own GetKey() method. /// </summary> /// <param name="service"></param> /// <param name="cache"></param> /// <param name="getIdDelegate"></param> /// <param name="flushCacheDelegateAsync"></param> /// <param name="options"></param> public CrudAutoCache(ICrudable service, GetIdDelegate <TModel, TId> getIdDelegate, IDistributedCache cache, FlushCacheDelegateAsync flushCacheDelegateAsync = null, AutoCacheOptions options = null) : base(service, getIdDelegate, cache, flushCacheDelegateAsync, options) { }
/// <summary> /// Constructor for TModel that implements <see cref="IUniquelyIdentifiable{TId}"/>. /// </summary> /// <param name="service"></param> /// <param name="cache"></param> /// <param name="flushCacheDelegateAsync"></param> /// <param name="options"></param> public CrudAutoCache(ICrudable <TModel, TId> service, IDistributedCache cache, FlushCacheDelegateAsync flushCacheDelegateAsync = null, AutoCacheOptions options = null) : this(service, item => ((IUniquelyIdentifiable <TId>)item).Id, cache, flushCacheDelegateAsync, options) { }