Deferred Execution (IQueryable) to database level without using ORM? - c#

Is there any easy reasonable/feasible way to efficiently pipeline results from the database?
I can't use any ORM tools. I believe LINQ-SQL does this with it's queryable interfaces which is what I wish to do here.

Based on your answer to the comments above, I think that what youre looking for is the LAZY LOAD PATTERN.
In few words, Martin F. describes this pattern as "An object that doesn't contain all of the data you need but knows how to get it."
So follow these links to learn more:
WIKIPEDIA,
MARTIN FOWLER

Related

LINQ to SQL “Active Record” and “Unit Of Work” Pattern

Can you please list references for articles that demonstrates the following two, using LINQ to SQL?
“Active Record” Pattern
“Unit Of Work” Pattern
When I search for them, I am getting most of the examples clubbed with Asp.Net MVC. I don’t need MVC. I am looking for a code implementation (in LINQ to SQL) which demonstrates these two patterns.
I think you'll struggle to find references to such an idea.
To a certain extent, the LINQ to SQL is already implementing these patterns behind the scenes. Therefore, I'm not sure there's much benefit to be gained from layering the additional behavior on top.
Do you have any more detail of what you're trying to achieve that might facilitate a more useful answer?

Decent code visible example of Entity Framework, POCO and a tiered architecture in the wild?

Can anyone point to a good example of an Entity Framework 4 based tiered architecture using POCOs in C#, preferably written from the aspect of introduction to the concept?
What I am looking for is something that shows off using POCOs in a higher tier, passing those back down the tiers to Entity Framework and into the database, with transforms going on as required.
I have seen a lot of articles based around one or the other, but nothing really that puts it all together in a "this is how it all works" example.
Cheers
Richard
It isnt the most loved example out there, but it has some good points. The implementation has some weak points, but its improved over time and doc accompying it is worth a read.
http://microsoftnlayerapp.codeplex.com/
The phrase "N-tier architecture" is being downplayed by the "Repository, Unit-of-Work, and Specification pattern" in a lot of articles. Using Repository, Unit-of-Work, and Specification means having an N-tier architecture. You can find lots of articles about this online. Here are some:
http://thedatafarm.com/blog/data-access/agile-entity-framework-4-repository-part-1-model-and-poco-classes/
http://elegantcode.com/2009/12/15/entity-framework-ef4-generic-repository-and-unit-of-work-prototype/
http://huyrua.wordpress.com/2010/07/13/entity-framework-4-poco-repository-and-specification-pattern/
http://www.hightech.ir/Tags/EntityFramework

What Should I know to underestand LINQ better?

As LINQ is a good query language in dot net and everyone should be able to work with it.
What are the necessary abilities which a programmer should have, before start learning LINQ.
And after that, What should he know about LINQ? (important tips)
What kind of Linq are you interested in - Linq to Objects, Linq to SQL, implementing your own Linq provider ?
My advice is that you should first learn about the features that Linq is based upon :
IQueryable and IEnumerable extension methods
Method chaining and deferred execution
Anonymous methods and lambda expressions
Linq query syntax
Expression trees (if you aim at implementing your Linq provider)
Then in turn these features rely on more basic concepts :
Generics
Delegates
Collections
A couple of books that could help you :
C# in depth (J. Skeet) - great book to learn C#
LINQ in Action (Marguerie, Eichert, Wooley)
A decent understanding of Closures / Lambda, IEnumerable, Generics, Expression Trees and Method Chaining, would be a good start. LINQ is pretty much just a utility set based upon that.
But you can definitely learn to utilize LINQ without a solid understanding of each and every single feature mentioned.
If you want to understand the principles behind LINQ than it is very useful to learn some basics of functional programming, because LINQ is largely based on this paradigm. Of course, you don't need that to use LINQ in practice, but it will help you understand what's going on under the cover (not to mention that learning functional programming is said to make you a better programmer anyway).
I wrote an overview article on this topic that you may find useful:
Functional Programming using C# and F#
Aside from functional programming, it really helps to understand all C# 3.0 features, most importantly lambda expressions, extension methods and also expression trees. Technically speaking, LINQ is just a clever combination of these three features, so once you understnad them, you can fully appreciate and benefit from LINQ.
101 LINQ samples really helped me to understand LINQ better http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx?ppud=4
There is a series of videos (8, I believe) Scott Stanfield called "LINQ TO SQL." They are very helpful to understand the concept and how to use LINQ.
Link Here
Or, try google: LINQ TO SQL + Scott Stanfield
I particularly like to use, but little use. is always good care ... but it is very useful. Watch the videos and draws its conclusions.
Enjoy!

Repository Pattern in C#

I am trying to figure out the repository pattern for .NET. I think I have a pretty decent understanding of it, but I still don't feel comfortable using it.
I have googled for this topic, but found some advanced topics along with the repository pattern. What I am looking for is a basic knowledge of the concept, then I can build on it. With that said, can I get a recommendation of some good articles on the repository pattern?
Thanks
See the answers to Repository pattern tutorial in C#.
I recommend start by Fowler's definition
This concrete implementation could help you as well : )
Ayende's Rhino.Commons has a decent implementation.
I also benefitted from reading "Domain-Driven Design" by Eric Evans, which gives a good foundation of understanding the motivations behind Repository.
Have a look at following Article.
Using the Repository Software Design
Pattern
If you go through the whole series above, will be more help full
I'm in exactly the same position you were in. I found this Remondo.net blog post particularly useful. It walks through the implementation of a basic repository:
The Repository Pattern Example in C#

What is the best starting point on the Entity Framework from MS?

Please give me the direction of the best guidance on the Entity Framework.
There is a list of some tutorials available in this question.
This is a useful Entity Framework forum.
For me, the most useful reference for learning about the Entity Framework when I started using it was Daniel Simmons' FAQ. Check it out!
Mike Taulty has a series of blog entries here that would be worth reading. But first - make sure you really, really want the complexity of EF; NHibernate, LINQ-to-SQL, etc make better answers in many cases. There are a number of issues with the EF approach (not least the forced base class and the much moire complicated xml - barely comprehensible).
I'm not saying don't use it: just make sure you need what it offers (at the price of complexity) first...

Categories