repository

Generic Repository with nHibernate

天大地大妈咪最大 提交于 2019-12-06 07:54:54
I currently have this class make up for my Generic Repository public abstract class RepositoryBase<T> where T : class { private readonly ISession session; public RepositoryBase(ISession session) { this.session = session; this.session.FlushMode = FlushMode.Auto; } public void Start() { this.session.BeginTransaction(); } public bool Add(T entity) { this.session.Save(entity); return true; } public bool AddAll(IEnumerable<T> items) { foreach (T item in items) { this.session.Save(item); } return true; } public bool Update(T entity) { this.session.Flush(); this.session.Update(entity); return true; }

Generic repository, DI, Aggregation Roots

落花浮王杯 提交于 2019-12-06 07:48:12
Having a generic repository like public class Repository<T> where T: Entity<T> { /*anything else*/ } should concrete repositories per agregation root like class ProductRepository : Repository<Product> { } class CategoryRepository : Repository<Category> { } be created? Also how do I use DI ( Ninject ) with generic implementation of repository. Samples are apreciated! Thanks! I see a lot of misuse of generics in the questions in SO and while it does not necessarily refer to your question (although it will help to clarify), I think once for all write a summary here. Generics is a typeless reuse

Gitweb not displaying some repos

萝らか妹 提交于 2019-12-06 07:46:40
I am trying to use Gitolite + Gitweb but I am running into some problems.. My conf/gitolite.conf is the following @dataset_repos = dat1 dat2 @closedsrc_repos = cod1 cod2 @opensrc_repos = testing @admins = user1 user2 @bios = user1 user2 user3 @coders = user1 user3 repo gitolite-admin RW+ = @admins repo @opensrc_repos RW+ = @all repo @dataset_repos RW+ = @admins @bios repo @closedsrc_repos RW+ = @admins @coders When I first inserted repository code1 and code2, git told me: remote: Initialized empty Git repository in /home/git/repositories/code1.git/ remote: Initialized empty Git repository in

One git for multiple folders in differents places

梦想的初衷 提交于 2019-12-06 07:14:19
I think this subject was asked before, but I didn't find anything interesting to work with. I read this Can I store the .git folder outside the files I want tracked? and Single Git repo with directories in multiple locations try to play with it, but didn't find the way to achieve this well. The goal of this, is to store backup preferences for applications and dotfiles. But the strucuture of files look to somethink like this -- /Users/Jeremy/Library/Application\ Support/Sublime\ Text\ 3/Packages/User ------ Theme ------ Snippet ------ Preferences.sublime-settings -- -- /Users/Jeremy/.gitconfig

Repository Pattern and Linq to sql

旧街凉风 提交于 2019-12-06 07:05:38
问题 I 'm trying to implement user authentication and authorization using roles table, user table and a xref table having userid, roleid. For implementing generic repoistory to update role, insert role, add user, add user to role, update user, update user role, authenticate user, add user session to audit etc do i have write seperate functions for each or can i use one generic method for similar functions. There are some other operations like joining user to other table and get top 5 rows based on

MVC 3/EF/SQL Server strange connection timeout issue

左心房为你撑大大i 提交于 2019-12-06 06:58:10
Before reading please note that I've googled this and read a ton of articles on SO and elsewhere, no suggestions have worked as of yet. I'm randomly getting a timeout error that occurs when logging into my MVC 3 application. It happens well over half of the time - all other times the application logs on just fine. When it doesn't work, it tries for about 10 seconds then errors. The error: Exception: "An error occurred while executing the command definition. See the inner exception for details." Inner Exception: {"Timeout expired. The timeout period elapsed prior to completion of the operation

Removing a weird file from git repository on mac

点点圈 提交于 2019-12-06 06:24:55
问题 I recently tried adding the OpenEars framework to my xcode project, and when I tried to commit my project to the repository I get the following error: error: pathspec '"Framework/Icon\r"' did not match any file(s) known to git. I have tried to find this file using the navigation tree within xcode but it doesn't exist. There is a physical file on the disk which was 0 bytes (this is most likely the problem), and I tried removing this with no affect. I tried to navigate to the file using

What's the best way to checkout selected files and folders from a bare git repository on linux?

五迷三道 提交于 2019-12-06 06:16:06
I'm setting up a git repository for a website on a GoDaddy shared hosting account. Normally one would set up a git bare repo on the server that contained the live web data only, then on a push to the remote use a git post-receive hook to checkout to the live directory (thanks to @VonC for the links). That's fine, but I've set up the repository to include work files as well. On the server I have, /home/username/repo.git/work_folders, and /home/username/repo/web_files_and_folders for the repository, and, /home/username/public_html/web_files_and_folders for the live files and folders. The work

If I need to retrieve an object from a custom model binder should the binder interact with the service layer, the repository layer, or …?

纵然是瞬间 提交于 2019-12-06 06:07:30
问题 If I have a class similar to this: public class Person { public string firstName { get; set; } public string lastName { get; set; } public Pet myPet { get; set; } } When I create a custom model binder, the Post from my form will not be sending in a Pet, it would send in data like this: firstName: "myFirstName" lastName: "myLastName" myPet: "myPetsName" Since the Pet's name is passed in, and not the actual Pet object, the Pet object needs to be retrieved from within the model binder. My

Is it considered bad design to pass a repository interface as an argument to a method on a domain class?

痞子三分冷 提交于 2019-12-06 05:42:49
Our domain model is very anemic right now. Our entities are mostly empty shells, almost purely designed for holding values and navigating to collections. We are using EF 4.1 code-first ORM, and the design so far has been to shield our novice developers against the dreaded "LINQ to Entities cannot translate blablabla to a store expression" exception when querying against the context during early iterations. We have various aggregate root repository interfaces over EF. However some blocks of code in the impls seems like they should be the domain's responsibility. As long as the repository