unit-of-work

Tracking model changes in SQLAlchemy

旧时模样 提交于 2019-12-02 22:28:31
I want to log every action what will be done with some SQLAlchemy-Models. So, I have a after_insert, after_delete and before_update hooks, where I will save previous and current representation of model, def keep_logs(cls): @event.listens_for(cls, 'after_delete') def after_delete_trigger(mapper, connection, target): pass @event.listens_for(cls, 'after_insert') def after_insert_trigger(mapper, connection, target): pass @event.listens_for(cls, 'before_update') def before_update_trigger(mapper, connection, target): prev = cls.query.filter_by(id=target.id).one() # comparing previous and current

The unit of work pattern within a asp.net mvc application

心已入冬 提交于 2019-12-02 19:47:25
I have been looking at this excellant blog titled "NHibernate and the Unit of Work Pattern" and have a question regarding the best place to use UnitOfWork.Start in a asp.net mvc project. My SLN is broken down into the following projects:- MVC project Repository NHibernateUnitOfWork I have an interface:- public interface INameRepository ... IList<Name> GetByOrigin(int OriginId) ... I have a concrete implementation public class NameRepository : INameRepository ... public IList<Name> GetByOrigin(int OriginId) { using (UnitOfWork.Start()) { var query = session.Linq<... return query; } } ... My

Using multiple DbContexts with a generic repository and unit of work

非 Y 不嫁゛ 提交于 2019-12-02 17:47:59
My application is getting larger and so far I have a single MyDbContext which has all the tables I need in my application. I wish (for the sake of overview) to split them up into multiple DbContext , like MainDbContext , EstateModuleDbContext , AnotherModuleDbContext and UserDbContext . I am unsure how this is done probably as I am right now using dependecy injection (ninject) to place my DbContext on my UnitOfWork class like: kernel.Bind(typeof(IUnitOfWork)).To(typeof(UnitOfWork<MyDbContext>)); Should I drop this approach with dependency injection and explicit set the DbContext I wish to use

Repository and Unit of Work patterns - How to save changes

 ̄綄美尐妖づ 提交于 2019-12-02 16:45:56
I'm struggling to understand the relationship between the Repository and Unit of Work patterns despite this kind of question being asked so many times. Essentially I still don't understand which part would save/commit data changes - the repository or the unit of work? Since every example I've seen relates to using these in conjunction with a database/OR mapper let's make a more interesting example - lets persist the data to the file system in data files; according to the patterns I should be able to do this because where the data goes is irrelevant. So for a basic entity: public class Account

'unitOfWork parameter cannot be null' in Background Worker

爷,独闯天下 提交于 2019-12-02 09:45:35
I've started getting these errors. It was working perfectly on my previous server. using System; using Abp.Dependency; using Abp.Domain.Repositories; using Abp.Threading.BackgroundWorkers; using EMS.IPs; using System.Threading.Tasks.Dataflow; using System.Threading.Tasks; using System.Linq; using EMS.Contacts; using System.Collections.Concurrent; using Abp.Domain.Uow; using System.Collections.Generic; using EMS.EmailValidation; using Microsoft.AspNetCore.SignalR; using KellermanSoftware.NetEmailValidation; using System.Net; using System.Collections; using System.Threading; using System

Ninject UnitOfWork confusion

百般思念 提交于 2019-12-02 08:46:09
I use Ninject all the time with my MVC 3 applications, but I'm trying to change the Pattern for my Data Objects to use UnitOfWork and I'm having trouble figuring out how to get Ninject to handle this properly. I know my implementation of classes work when they are constructed manually like this in my console application: IDatabaseFactory factory = new DatabaseFactory(); IUnitOfWork worker = new UnitOfWork(factory); IBlogCategoryDao dao = new BlogCategoryDao(factory); IBlogCategoryService service = new BlogCategoryService(dao); BlogCategory category = service.GetById(id); try { if (category !=

MVC3 EF Unit of Work + Generic Repository + Ninject

陌路散爱 提交于 2019-12-01 06:12:32
I'm new to MVC3 and have been following the awesome tutorials on the asp.net website. However, I can't quite wrap my head around how to use Unit of Work and Generic Repository patterns with Ninject. I used this tutorial as a starting point: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application Without using interfaces, I know I can implement it like so: Generic Repository: public class GenericRepository<TEntity> : IGenericRepository<TEntity> where TEntity : class { internal MyContext context;

How to design unit of work to support bulk operations and give more performance?

情到浓时终转凉″ 提交于 2019-12-01 06:08:21
I have 2 different units of work: one based on ADO.NET , calling stored procedures mostly ( uowADO ) and another one using Entity Framework 6 ( uowEF ), added recently in order to support Oracle db, so that I don't have to rewrite all the SPs (my knowledge is limited there). So, business layer is loading only one of them (based on configuration) when performing operations over database (but I can't use them in parallel, because uowADO does not support Oracle) After adding the new uowEF I noticed big performance issues, of course mainly on the bulk operations. Basically I have only Commit and

MVC3 EF Unit of Work + Generic Repository + Ninject

女生的网名这么多〃 提交于 2019-12-01 05:30:51
问题 I'm new to MVC3 and have been following the awesome tutorials on the asp.net website. However, I can't quite wrap my head around how to use Unit of Work and Generic Repository patterns with Ninject. I used this tutorial as a starting point: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application Without using interfaces, I know I can implement it like so: Generic Repository: public class

How to design unit of work to support bulk operations and give more performance?

柔情痞子 提交于 2019-12-01 03:10:38
问题 I have 2 different units of work: one based on ADO.NET , calling stored procedures mostly ( uowADO ) and another one using Entity Framework 6 ( uowEF ), added recently in order to support Oracle db, so that I don't have to rewrite all the SPs (my knowledge is limited there). So, business layer is loading only one of them (based on configuration) when performing operations over database (but I can't use them in parallel, because uowADO does not support Oracle) After adding the new uowEF I