Hi there,
i have been successfully working with linq2sql and the linq DTOs (the classes that are created by linq2sql) ....
I am confused, i have the task of updating an old application and i can see that my DTOs will be used how they should be .... to transport date
I am using the repository pattern so i am passing data from the repos...
I am experiencing a very frustrating issue when trying to insert a new record
using LINQ to SQL. If I step through this code sometimes it inserts the new record
but most of the time it doesn't. When it fails I seeing the following error.
Cannot insert the value NULL into
column 'Name', table
'EquipmentManufacturer'; column does
...
So I'm implementing the repository pattern in an application and came across two "issues" in my understanding of the pattern:
Querying - I've read responses that IQueryable should not be used when using repositories. However, it's obvious that you'd want to so that you are not returning a complete List of objects each time you call a m...
I've implemented a repository pattern with persistence ignorance. The repository implementation only interacts with my entity objects, IUnitOfWork and ITable<T> interfaces. The intention is that the IUnitOfWork isn't reused but represents a single transaction. So far, I've implemented in-memory as well as Linq-to-Sql versions of the IUni...
Hi
When creating a repository class, eg. CustomerRepository, should my methods be static?
Or should I first instanciate the CustomerRepository class, and then call the public methods on the instance?
Which approach is best and why?
Thanks
...
There is a study here my co-worker took to my notice. Basically, that in-line form validation is a good thing.
But how would you do in-line multi-field form validation in MVC assuming you already have a "yield return" setup to return a list of form violations? Is the in-line validation only for primitive values like "a zip code should...
Hi
I am trying to figure out how to tackle this problem. I have to insert some data into 2 tables lets call them Table A and Table B.
Table A has these columns
AId<PK>
A1
A2
A3
Table B has
AId<PK>
A1
B2
B3
B4
Now my first question was should another repository call another repository? I don't think this will solve my current proble...
I'm attempting to use the Repository Pattern to write a data access layer on an existing DB2 schema. This schema has several aggregates all having a common base entity of a "Document." When building the business objects, I created the Document entity as an abstract, and the aggregates as entities derived from Document. For example:
p...
I'm building an ASP.NET MVC app and I'm using a repository to store and retrieve view objects. My question is, is it okay for the implementation of the various repositories to call each other? I.E. can the ICustomerRepository implementation call an implementation of IAddressRepository, or should it handle its own updates to the address d...
I'm reading the book "ASP.NET 3.5 Social Networking - Andrew Siemer" and I got confused when he uses Repositories to access the data.
Here is the idea of his code:
public interface IAccountRepository
{
Account GetAcountByID(int acId);
void SaveAccount(Account account);
List<Account> GetAllAccounts();
}
public class Account...
Hi there,
I am using a standard repository pattern with a service layer which calls the data layer..
I have some Utility classes i.e. one that deals with Sending email (method name = SendMail)
Where is the correct place to put this?
Inside the service layer as a method called SendMail
hence I have CustomerService which calls Custome...
As seems to be popular at the moment, if you implement a repository as simply
IQueryable<T> FetchAll<T>();
using LINQ to SQL, then the repository must set up a DataContext which remains available outside of the repository.
So my question is, How does the DataContext get Disposed?
What if an exception is generated by the code outside ...
Hi,
I'm trying to implement the repository pattern using a generic repository like the one found here: Implementing Repository Pattern With Entity Framework
I've created a test suite (I'm using NUnit) to test the repository but I've been having issues. Here's the error I'm getting:
MyBusiness.Test.Domain.RepositoryTest.SelectCol:
...
Can someone please check out this code, i really dont understand why i got violation of unique when i try to update an record. the code used to create new record work just fine, but when i try to use it to update, it called out violation.
Controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(User user)
{
...
I'm working on a generic repository and I would like to test it using a NUnit.Mocks . According to Mike Hadlow in his article you can do it using Rhino mocks like this:
User[] users = new User[] { };
...
Expect.Call(userRepository.GetAll()).Return(users);
So I thought maybe I could write the same thing in NUnit.Mocks like this :
data...
I am trying to write a generic repository that will perform basic methods on all my linq2sql classes. (getById, insert, delete, getAll)
Im not so sure on how to get this done.
Heres what I got so far... the getById method is giving me an error cause it cant relate Id attribute to 'T' class. I would appreciate some pointers on how to wr...
Hi everyone,
I want to take your opinion about the performance of the following architecture which I have in an ASP.NET MVC project I am working on.
Thanks!
...
Hi,
I am starting with DDD. I am a bit confused with the interaction between the several layers involved in a DDD application.
Can I call my repositories from my presentation layer? If not do I have to replicate the CRUD functionality provided by the repositories in my service layer (which ofcourse will in turn use the repository for ...
Very new to FluentNHibernate, but I'm also excited about the area. I've recently started work on a new DAL using the aforementioned and have been reading up on the Repository pattern. I like the generic form this pattern takes and am looking to use this pattern in conjunction with the UnitOfWork pattern for session management.
I'm curio...
I've been exploring BDD/DDD and as a consequence trying to come up with a proper implementation of the Repository pattern. So far, it's been hard to find a consensus over the best way to implement this. I've tried to boil it down to the following variations, but I'm unsure which is the best approach.
For reference I'm building an ASP.MV...