I am about to develop a new application and am considering the best practices
I have read about ActiveRecords and I have used it before but I always want something that would make changes easier and less time consuming.
Using active record and other ORMs:
I believe that these methods loads all records from the database when sometimes I may need just one or two
Like if I want to do paging, i need to pass the pageIndex and pageSize, how would you do that without loading all the data
Like if i want multiple fields in my WHERE clause
Wouldn’t I load all records and filter based on my criteria
I would like all the selection/filtering/sorting to happen at the database level
Adding static methods to perform those operations look like I would be doing the wrong thing
Are there ORMs that handle that gracefully?
I want to have utmost control over the application flow so I can easily optimize when necessary.
Note: I am still researching on DAO and other methods but I want opinions on Active Record in case I still want to use it
Thanks
If you are using C# 3.5+, I believe
Linq,IQueryableand proper Data Service Layer can solve your problem.e.g.
Filtering and WHERE. Same as above
Most ORM works with Linq. E.g. NHibernate
Probably you need to write your own custom Linq Providers, but trust me, you don’t have to.