Search Results

Search found 10046 results on 402 pages for 'repository pattern'.

Page 6/402 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Problem updating through LINQtoSQL in MVC application using StructureMap, Repository Pattern and UoW

    - by matt
    I have an ASP MVC application using LINQ to SQL for data access. I am trying to use the Repository and Unit of Work patterns, with a service layer consuming the repositories and unit of work. I am experiencing a problem when attempting to perform updates on a particular repository. My application architecture is as follows: My service class: public class MyService { private IRepositoryA _RepositoryA; private IRepositoryB _RepositoryB; private IUnitOfWork _unitOfWork; public MyService(IRepositoryA ARepositoryA, IRepositoryB ARepositoryB, IUnitOfWork AUnitOfWork) { _unitOfWork = AUnitOfWork; _RepositoryA = ARepositoryA; _RepositoryB = ARepositoryB; } public PerformActionOnObject(Guid AID) { MyObject obj = _RepositoryA.GetRecords() .WithID(AID); obj.SomeProperty = "Changed to new value"; _RepositoryA.UpdateRecord(obj); _unitOfWork.Save(); } } Repository interface: public interface IRepositoryA { IQueryable<MyObject> GetRecords(); UpdateRecord(MyObject obj); } Repository LINQtoSQL implementation: public class LINQtoSQLRepositoryA : IRepositoryA { private MyDataContext _DBContext; public LINQtoSQLRepositoryA(IUnitOfWork AUnitOfWork) { _DBConext = AUnitOfWork as MyDataContext; } public IQueryable<MyObject> GetRecords() { return from records in _DBContext.MyTable select new MyObject { ID = records.ID, SomeProperty = records.SomeProperty } } public bool UpdateRecord(MyObject AObj) { MyTableRecord record = (from u in _DB.MyTable where u.ID == AObj.ID select u).SingleOrDefault(); if (record == null) { return false; } record.SomeProperty = AObj.SomePropery; return true; } } Unit of work interface: public interface IUnitOfWork { void Save(); } Unit of work implemented in data context extension. public partial class MyDataContext : DataContext, IUnitOfWork { public void Save() { SubmitChanges(); } } StructureMap registry: public class DataServiceRegistry : Registry { public DataServiceRegistry() { // Unit of work For<IUnitOfWork>() .HttpContextScoped() .TheDefault.Is.ConstructedBy(() => new MyDataContext()); // RepositoryA For<IRepositoryA>() .Singleton() .Use<LINQtoSQLRepositoryA>(); // RepositoryB For<IRepositoryB>() .Singleton() .Use<LINQtoSQLRepositoryB>(); } } My problem is that when I call PerformActionOnObject on my service object, the update never fires any SQL. I think this is because the datacontext in the UnitofWork object is different to the one in RepositoryA where the data is changed. So when the service calls Save() on it's IUnitOfWork, the underlying datacontext does not have any updated data so no update SQL is fired. Is there something I've done wrong in the StrutureMap registry setup? Or is there a more fundamental problem with the design? Many thanks.

    Read the article

  • Cloning git repository from svn repository, results in file-less, remote-branch-less git repo.

    - by Tchalvak
    Working SVN repo I'm starting a git repo to interact with a svn repo. The svn repository is set and working fine, with a single commit of a basic README file in it. Checking it out works fine: tchalvak:~/test/svn-test$ svn checkout --username=myUsernameHere http://www.url.to/project/here/charityweb/ A charityweb/README Checked out revision 1. Failed git-svn clone of svn repo When I try to clone the repository in git, the first step shows no errors... tchalvak:~/test$ git svn clone -s --username=myUserNameHere http://www.url.to/project/here/charityweb/ Initialized empty Git repository in /home/tchalvak/test/charityweb/.git/ Authentication realm: <http://www.url.to/project/here:80> Charity Web Password for 'myUserNameHere': ...but results in a useless folder: tchalvak:~/test$ ls charityweb tchalvak:~/test$ cd charityweb/ tchalvak:~/test/charityweb$ ls tchalvak:~/test/charityweb$ ls -al total 12 drwxr-xr-x 3 tchalvak tchalvak 4096 2010-04-02 13:46 . drwxr-xr-x 4 tchalvak tchalvak 4096 2010-04-02 13:46 .. drwxr-xr-x 8 tchalvak tchalvak 4096 2010-04-02 13:47 .git tchalvak:~/test/charityweb$ git branch -av tchalvak:~/test/charityweb$ git status # On branch master # # Initial commit # nothing to commit (create/copy files and use "git add" to track) tchalvak:~/test/charityweb$ git fetch fatal: Where do you want to fetch from today? tchalvak:~/test/charityweb$ git rebase origin/master fatal: bad revision 'HEAD' fatal: Needed a single revision invalid upstream origin/master tchalvak:~/test/charityweb$ git log fatal: bad default revision 'HEAD' How do I get something I can commit back to? I expect I'm doing something wrong in this process, but what?

    Read the article

  • Fluent NHibernate Repository with subclasses

    - by reallyJim
    Having some difficulty understanding the best way to implement subclasses with a generic repository using Fluent NHibernate. I have a base class and two subclasses, say: public abstract class Person { public virtual int PersonId { get; set; } public virtual string FirstName { get; set; } public virtual string LastName { get; set; } } public class Student : Person { public virtual decimal GPA { get; set; } } public class Teacher : Person { public virtual decimal Salary { get; set; } } My Mappings are as follows: public class PersonMap : ClassMap { public PersonMap() { Table("Persons"); Id(x => x.PersonId).GeneratedBy.Identity(); Map(x => x.FirstName); Map(x => x.LastName); } } public class StudentMap : SubclassMap<Student> { public StudentMap() { Table("Students"); KeyColumn("PersonId"); Map(x => x.GPA); } } public class TeacherMap : SubclassMap<Teacher> { public TeacherMap() { Table("Teachers"); KeyColumn("PersonId"); Map(x => x.Salary); } } I use a generic repository to save/retreive/update the entities, and it works great--provided I'm working with Repository--where I already know that I'm working with students or working with teachers. The problem I run into is this: What happens when I have an ID, and need to determine the TYPE of person? If a user comes to my site as PersonId = 23, how do I go about figuring out which type of person it is?

    Read the article

  • Can't create directory named "mysql" in subversion repository

    - by High Ball
    I have a particular problem with subversion. Environment: subversion (1.6.12dfsg-6), apache2 (2.2.16-6+squeeze7) + mod dav_svn. I can't create a directory named "mysql" or "testmysql" or add and commit a file named "mysql.txt" in my repository. There are many references to "subversion PROPSET 403 forbidden" problems in google and so on. But I can use all functions of subversion. I can also create a directory named "hugo" or "test". My repository works properly. Only "mysql" doesn't work. The following errors occur: The server encountered an unexpected return value (403 Forbidden) in response to the request for MKCOL »/svn/repository/!svn/wrk/8123484e-8890-412d-92ed-62ceabcd4189 /etc/mysql" returned /var/log/apache2/access.log 192.168.178.200 - - [time] "OPTIONS /svn/repository/etc HTTP/1.1" 401 6156 "-" "SVN/1.6.12 (r955767) neon/0.29.3" 192.168.178.200 - user1 [time] "OPTIONS /svn/repository/etc HTTP/1.1" 200 1028 "-" "SVN/1.6.12 (r955767) neon/0.29.3" 192.168.178.200 - user1 [time] "MKACTIVITY /svn/repository/!svn/act/6564e2e2-19be-4a09-bcb6-61a1cfb097e8 HTTP/1.1" 201 676 "-" "SVN/1.6.12 (r955767) neon/0.29.3" 192.168.178.200 - user1 [time] "PROPFIND /svn/repository/etc HTTP/1.1" 207 676 "-" "SVN/1.6.12 (r955767) neon/0.29.3" 192.168.178.200 - user1 [time] "CHECKOUT /svn/repository/!svn/vcc/default HTTP/1.1" 201 692 "-" "SVN/1.6.12 (r955767) neon/0.29.3" 192.168.178.200 - user1 [time] "PROPPATCH /svn/repository/!svn/wbl/6564e2e2-19be-4a09-bcb6-61a1cfb097e8/157 HTTP/1.1" 207 580 "-" "SVN/1.6.12 (r955767) neon/0.29.3" 192.168.178.200 - user1 [time] "PROPFIND /svn/repository/etc HTTP/1.1" 207 564 "-" "SVN/1.6.12 (r955767) neon/0.29.3" 192.168.178.200 - user1 [time] "CHECKOUT /svn/repository/!svn/ver/157/etc HTTP/1.1" 201 692 "-" "SVN/1.6.12 (r955767) neon/0.29.3" 192.168.178.200 - user1 [time] "MKCOL /svn/repository/!svn/wrk/6564e2e2-19be-4a09-bcb6-61a1cfb097e8/etc/mysql HTTP/1.1" 403 596 "-" "SVN/1.6.12 (r955767) neon/0.29.3" 192.168.178.200 - user1 [time] "DELETE /svn/repository/!svn/act/6564e2e2-19be-4a09-bcb6-61a1cfb097e8 HTTP/1.1" 204 165 "-" "SVN/1.6.12 (r955767) neon/0.29.3" Has anyone seen this before? Thanks for any advice.

    Read the article

  • svn merge - moved repository to a different server, and now getting 'has different repository root'

    - by HorusKol
    This is kind of similar to http://stackoverflow.com/questions/1601021/subversion-merge-has-different-repository-root-than - but appears to be a very different cause (especially as the answer for that question didn't resolve my problem). A while back, we swapped out the server where our SVN repositories are located - but we've been using an alias so that the old server name points to the new server. I've been getting in the habit where I will use the new server name wherever I checkout new working copies - but we having made changes to most of the current working copies as they are live websites. Until now, this hasn't been a problem - except that this morning I merged in some changes from my development branch to a working copy I have of the release version and I got the message "file has different repository root" and the merge stops dead. I know this is because I'm using the new server name when the development branch was updated via the old server name - but is there a simple way to fix this? Or if not a simple way - is there a well-documented way to fix this?

    Read the article

  • Migrate SVN repository from Google code to another repository server (keeping history)

    - by Marco Demaio
    I read some question/answers here about how to do it using svnadmin/dump etc. Actually I did not understand properly what I'm supposed to do. http://stackoverflow.com/questions/939963/how-to-migrate-svn-to-another-repository I think I have to do some sort of dump from the Google code repository using svnadmin, but where do I get this svnadmin? I use TortoiseSVN 1.6.3 on WXP and there is no svnadmin.exe command in all my C folder, where am I supposed to download these applications? Thanks!

    Read the article

  • Using the Specification Pattern

    - by Kane
    Like any design pattern the Specification Pattern is a great concept but susceptible to overuse by an eager architect/developer. I am about to commence development on a new application (.NET & C#) and really like the concept of the Specification Pattern and am keen to make full use of it. However before I go in all guns blazing I would be really interested in knowing if anyone could share the pain points that experienced when use the Specification Pattern in developing an application. Ideally I'm looking to see if others have had issues in Writing unit tests against the specification pattern Deciding which layer the specifications should live in (Repository, Service, Domain, etc) Using it everywhere when a simple if statement would have done the job etc? Thanks in advance

    Read the article

  • Is component-based design an architectural pattern or design pattern?

    - by xEnOn
    When using the component-based paradigm in game development with engines like Unity, is component-based design an architectural pattern, or a design pattern? Can I even say that component-based design is my "main" architectural pattern for my game? I see architectural patterns as being more high-level than design pattern. The component-based design in game development's context (like with Unity engine) seems to fit as an architectural pattern to me. However, on some sites, I read that component-based design is a behavioural pattern, much like other behavioural design patterns, and not so much like an architectural pattern like MVC.

    Read the article

  • Repository Pattern with Entity Framework 3.5 and MVVM

    - by Ravi
    I am developing a Database File System. I am using - .Net framework 3.5 Entity Framework 3.5 WPF with MVVM pattern The project spans across multiple assemblies each using same model. One assembly,let's call it a "server", only adds data to the database using EF i.e. same model.Other assemblies (including the UI) both reads and writes the data.The changes made by server should immediately reflect in other assemblies. The database contains self referencing tables where each entity can have single OR no parent and (may be) some children. I want to use repository pattern which can also provide some mechanism to handle this hierarchical nature. I have already done reading on this on Code Project. It shares the same context(entities) everywhere. My question is - Should I share the same context everywhere? What are the advantages and disadvantages of doing that?

    Read the article

  • Repository Pattern and Entity Framework.

    - by vitorcast
    Hi people, I want to make an implementation with repository pattern with ASP.NET MVC 2 and Entity Framework but I have had some issues in the process. First of all, I have 2 entities that has a relationship between them, like Order and Product. When I generate my dbml file it gaves me a class Order with a property that map a "ProductSet" and one class Product with a property that map wich Order that Product relates itself. So I create my Repository pattern like IReporitory with the basic CRUD operations and inside my controllers I implement the ProductRepository or OrderRepository. The problem occurs when I try to create Product and have to assign my Order on it, like ProductOne.Order = _orderRepository.Find(orderId); That operation gave me some strange behavior and I can't find out what is wrong with it. Thanks for the help.

    Read the article

  • Repository Pattern with Entity Framework 3.5

    - by Ravi
    I am developing a Database File System. I am using - .Net framework 3.5 Entity Framework 3.5 WPF with MVVM pattern The project spans across multiple assemblies each using same model. One assembly,let's call it a "server", only adds data to the database using EF i.e. same model.Other assemblies (including the UI) both reads and writes the data.The changes made by server should immediately reflect in other assemblies. The database contains self referencing tables where each entity can have single OR no parent and (may be) some children. I want to use repository pattern which can also provide some mechanism to handle this hierarchical nature. I have already done reading on this on Code Project. It shares the same context(entities) everywhere. My question is - Should I share the same context everywhere? What are the advantages and disadvantages of doing that?

    Read the article

  • Repository Pattern with Entity Framework 3.5

    - by Ravi
    I am developing a Database File System. I am using - .Net framework 3.5 Entity Framework 3.5 WPF with MVVM pattern The project spans across multiple assemblies each using same model. One assembly,let's call it a "server", only adds data to the database using EF i.e. same model.Other assemblies (including the UI) both reads and writes the data.The changes made by server should immediately reflect in other assemblies. The database contains self referencing tables where each entity can have single OR no parent and (may be) some children. I want to use repository pattern which can also provide some mechanism to handle this hierarchical nature. I have already done reading on this on Code Project. It shares the same context(entities) everywhere. My question is - Should I share the same context everywhere? What are the advantages and disadvantages of doing that?

    Read the article

  • Using Repository and Unit of Work patterns with Entity Framework 4.0 and MVC 2

    - by Mr. D
    Hi, I'm following this article Using Repository and Unit of Work patterns with Entity Framework 4.0. I'm tying to implement the Repository and Unit of work pattern, using Asp.Net MVC 2 and Entity Framework 4. Please let me know if I'm doing it right... In the Models folder: Northwind.edmx Products.cs (POCO class) ProductRepository.cs (Did my product query) IProductRepository.cs NorthwindContext.cs IUnitOfWork.cs In the Controller folder: ProductController.cs (Retrieve from ProductRepository.cs and Pass it to the view) When I run the application, I'm getting error message: Mapping and metadata information could not be found for EntityType 'NorthwindMvcPoco.Models.Category'. I don't know what I'm doing wrong. I search through whole web and I couldn't resolve this issue. Please help me.

    Read the article

  • RIA Services Repository Save does not work!?

    - by Savvas Sopiadis
    Hello everybody! Doing my first SL4 MVVM RIA based application and i ran into the following situation: updating a record (EF4,NO-POCOS!!) in the SL-client seems to take place, but values in the dbms are unchanged. Debugging with Fiddler the message on save is (amongst others): EntityActions.nil? b9http://schemas.microsoft.com/2003/10/Serialization/Arrays^HasMemberChanges?^Id?^ Operation?Update I assume that this says only: hey! the dbms should do an update on this record, AND nothing more! Is that right?! I 'm using a generic repository like this: public class Repository<T> : IRepository<T> where T : class { IObjectSet<T> _objectSet; IObjectContext _objectContext; public Repository(IObjectContext objectContext) { this._objectContext = objectContext; _objectSet = objectContext.CreateObjectSet<T>(); } public IQueryable<T> AsQueryable() { return _objectSet; } public IEnumerable<T> GetAll() { return _objectSet.ToList(); } public IEnumerable<T> Find(Expression<Func<T, bool>> where) { return _objectSet.Where(where); } public T Single(Expression<Func<T, bool>> where) { return _objectSet.Single(where); } public T First(Expression<Func<T, bool>> where) { return _objectSet.First(where); } public void Delete(T entity) { _objectSet.DeleteObject(entity); } public void Add(T entity) { _objectSet.AddObject(entity); } public void Attach(T entity) { _objectSet.Attach(entity); } public void Save() { _objectContext.SaveChanges(); } } The DomainService Update Method is the following: [Update] public void UpdateCulture(Culture currentCulture) { if (currentCulture.EntityState == System.Data.EntityState.Detached) { this.cultureRepository.Attach(currentCulture); } this.cultureRepository.Save(); } I know that the currentCulture-Entity is detached. What confuses me (amongst other things) is this: is the _objectContext still alive? (which means it "will be"??? aware of the changes made to record, so simply calling Attach() and then Save() should be enough!?!?) What am i missing? Development Environment: VS2010RC - Entity Framework 4 (no POCOs) Thanks in advance

    Read the article

  • Gradle: Make a 3rd party jar available to local gradle repository

    - by MH
    Hi, currently, I'm testing Gradle as an alternative to Maven. In my projects, there are some 3rd party jars, which aren't available in any (Maven) repositories. My problem is now, how could I manage it to install these jars into my local .gradle repository. (If it's possible, I don't want to use the local Maven repository, because Gradle should run independently.) At the moment, I get a lot of exceptions because of missing jars. In Maven, it's quite simple by running the install command. However, my Google search for something similar to the Maven install command wasn't successful. Has anybody an idea? Thanks a million in advance.

    Read the article

  • Proper reconstitution of Aggregate objects in the Repository?

    - by Jebb
    Assuming that no ORM (e.g. Doctrine) is used inside the Repository, my question is what is the proper way of instantiating the Aggregate objects? Is it instantiating the child objects directly inside the Repository and just assign it to the Aggregate Root through its setters or the Aggregate Root is responsible of constructing its child entities/objects? Example 1: class UserRepository { // Create user domain entity. $user = new User(); $user->setName('Juan'); // Create child object orders entity. $orders = new Orders($orders); $user->setOrders($orders); } Example 2: class UserRepository { // Create user domain entity. $user = new User(); $user->setName('Juan'); // Get orders. $orders = $ordersDao->findByUser(1); $user->setOrders($orders); } whereas in example 2, instantiation of orders are taken care inside the user entity.

    Read the article

  • Subversion Repository Layout

    - by Tim Long
    Most subversion tools create a default repository layout with /trunk, /branches and /tags. The documentation also recommends not using separate repositories for each project, so that code can be more easily shared. Following that advice has led to me having a repository with the following layout: /trunk /Project1 /Project2 /branches /Project1 /Project2 /tags /Project1 /Project2 and so on, you get the idea. Over time, I've found this structure a bit clumsy and it occurred to me that there's an alternative interpretation of the recommendations, such as: /Project1 /trunk /branches /tags /Project2 /trunk /branches /tags So, which layout do people use, and why? Or - is there another way to do things that I've completely missed?

    Read the article

  • LINQ to SQL repository - caching data

    - by creativeincode
    I have built my first MVC solution and used the repository pattern for retrieving/inserting/updating my database. I am now in the process of refactoring and I've noticed that a lot of (in fact all) the methods within my repository are hitting the database everytime. This seems overkill and what I'd ideally like is to do is 'cache' the main data object e.g. 'GetAllAdverts' from the database and to then query against this cached object for things like 'FindAdvert(id), AddAdvert(), DeleteAdvert() etc..' I'd also need to consider updating/deleting/adding records to this cache object and the database. What is the best apporoach for something like this? My knowledge of this type of things is minimal and really looking for advice/guidance/tutorial to point me in the right direction. Thanks in advance.

    Read the article

  • Repository vs Data Access

    - by vdh_ant
    Hi guys In the context of the n-tier application, is there a difference between what you would consider your data access classes to be and your repositories? I tend to think yes but I just wanted to see what other thought. My thinking is that the job of the repository is just to contain and execute the raw query itself, where as the data access class would create the context, execute the repository (passing in the context), handle mapping the data model to the domain model and return the result back up... What do you guys think? Also do you see any of this changing in a Linq to XML scenario (assuming that you change the context for the relevant XDocument)? Cheers Anthony

    Read the article

  • One repository/multiple projects without getting mixed up?

    - by OverTheRainbow
    Hello After reading Joel's last article on Mercurial, I'm giving it a shot on XP as a single-user, single-computer source control system. One thing I'd like to check, though, is: It'd be easier to just create a repository of all the tiny projects I keep in eg. C:\VB.Net\, but the result is that the changes I make to the different projects therein (C:\VB.Net\ProjectA\, C:\VB.Net\ProjectB\, etc.) will be mixed in a single changelog. But if I use a single repository for all projects, when I do diff's or go through the change history, will I be able to filter data so that I only see changes pertaining to a given project? Otherwise, is creating repositories in each project directory the only solution? Thank you.

    Read the article

  • F# Active Pattern List.filter or equivalent

    - by akaphenom
    I have a records of types type tradeLeg = { id : int ; tradeId : int ; legActivity : LegActivityType ; actedOn : DateTime ; estimates : legComponents ; entryType : ShareOrDollarBased ; confirmedPrice: DollarsPerShare option; actuals : legComponents option ; type trade = { id : int ; securityId : int ; ricCode : string ; tradeActivity : TradeType ; enteredOn : DateTime ; closedOn : DateTime ; tradeLegs : tradeLeg list ; } Obviously the tradeLegs are a type off of a trade. A leg may be settled or unsettled (or unsettled but price confirmed) - thus I have defined the active pattern: let (|LegIsSettled|LegIsConfirmed|LegIsUnsettled|) (l: tradeLeg) = if Helper.exists l.actuals then LegIsSettled elif Helper.exists l.confirmedPrice then LegIsConfirmed else LegIsUnsettled and then to determine if a trade is settled (based on all legs matching LegIsSettled pattern: let (|TradeIsSettled|TradeIsUnsettled|) (t: trade) = if List.exists ( fun l -> match l with | LegIsSettled -> false | _ -> true) t.tradeLegs then TradeIsSettled else TradeIsUnsettled I can see some advantages of this use of active patterns, however i would think there is a more efficient way to see if any item of a list either matches (or doesn't) an actie pattern without having to write a lambda expression specifically for it, and using List.exist. Question is two fold: is there a more concise way to express this? is there a way to abstract the functionality / expression (fun l - match l with | LegIsSettled - false | _ - true) Such that let itemMatchesPattern pattern item = match item with | pattern -> true | _ -> false such I could write (as I am reusing this design-pattern): let curriedItemMatchesPattern = itemMatchesPattern LegIsSettled if List.exists curriedItemMatchesPattern t.tradeLegs then TradeIsSettled else TradeIsUnsettled Thoughts?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >