Click here to Skip to main content
15,902,299 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
AnswerRe: Database Queries Pin
Wendelius7-Jan-09 2:29
mentorWendelius7-Jan-09 2:29 
GeneralRe: Database Queries Pin
CodingYoshi7-Jan-09 8:49
CodingYoshi7-Jan-09 8:49 
GeneralRe: Database Queries Pin
Wendelius7-Jan-09 9:16
mentorWendelius7-Jan-09 9:16 
GeneralRe: Database Queries Pin
Jon Rista7-Jan-09 12:20
Jon Rista7-Jan-09 12:20 
GeneralRe: Database Queries Pin
Wendelius8-Jan-09 2:47
mentorWendelius8-Jan-09 2:47 
GeneralRe: Database Queries [modified] Pin
Jon Rista8-Jan-09 4:55
Jon Rista8-Jan-09 4:55 
GeneralRe: Database Queries Pin
Wendelius8-Jan-09 5:25
mentorWendelius8-Jan-09 5:25 
GeneralRe: Database Queries Pin
Jon Rista8-Jan-09 10:56
Jon Rista8-Jan-09 10:56 
Glad I understood your questions. Wink | ;)

Regarding the next few. I'll start with networks. I call a 'network' a 'graph'...actually, I call trees or networks 'object graphs'. This is actually a very good question, and its also pretty much exactly WHY we have O/RM systems. To give you a clearer idea of what an ORM is...Object/Relational Mapper. The concept behind this term is that the way we work with objects is not directly translatable to how we store and manage data. Objects are usually represented by a 'graph' (or network, if I understand you correctly) in memory. A set of objects related through pointers, with a variety of navigability (sometimes we can only go from parent to child...sometimes we can go from parent to child and child to parent). Data is usually represented as sets of tuples (many tables of rows), with relationships defined external to the tuples themselves (foreign keys defined for tables rather than tables containing direct pointers). These differences create what we call the impedance missmatch between objects and databases, and its this impedance missmatch that O/RM's are specifically trying to solve.

Object relational mappers handle the process of 'bridging the gap' for you so you don't have to worry about it. That gap is where the process of building an object graph, or network, from relational data needs to happen. L2S can handle object graphs very well, and can build an entire network of objects from a single result set queried from the datase in most situations. Sometimes a graph is too complex to be retrieved in a single query, or sometimes the missmatch between your conceptual model and the database schema is too great, and additional queries are required. Regardless of what is needed for each specific scenario, the benefit of an O/RM is that it does the gritty work of solving that problem for you. All you need to worry about, once the O/RM is in place, is querying your conceptual model (note, when you query with an O/RM, you arn't really querying the database...your querying your model). If a parent object needs a pointer to its children, and all of its children need pointers back to the parent, the O/RM sets those pointers up for you...when you get a graph result back from your O/RM, its fully constructed and all relationships are in tact.

As for LINQ being dynamic. It actually is very dynamic, but its not obvious in the first few glances how. Critical thing about LINQ is that its what we call delay-loaded, or delay-bound. When you write a LINQ statement, that statemnt is actually just setting up an enumerator. The database, or whatever it is your querying, doesn't actually get queried until you actually iterate over that enumerator. So, when you need to have dynamic conditions, adding them with LINQ is actually quite easy:

var query = from o in MyObjects select o;

// Apply dynamic criteria
if (minID > Int32.MinValue)
{
    query = query.Where(o => o.ID >= minID);
}

if (maxID > Int32.MaxValue)
{
    query = query.Where(o => o.ID <= maxID);
}

if (name != null && IsEqual)
{
    query = query.Where(o => o.Name == name);
}
else if (name != null && ContainedWithin)
{
    query = query.Where(o => o.Name.Contains(name));
}

// Apply dynamic order by
switch (orderField)
{
    case "Name": query = query.OrderBy(o => o.Name); break;
    case "ID": query = query.OrderBy(o => o.ID); break;
    default: query = query.OrderBy(o => o.OrderIndex); break;
}

// Our query is now set up, lets iterate it to retrieve and process data
foreach (var result in query)
{
    Console.WriteLine("ID: " + result.ID + ", Name: " + result.Name);
}

GeneralRe: Database Queries Pin
Mark Churchill7-Jan-09 13:53
Mark Churchill7-Jan-09 13:53 
QuestionSoftware development Pin
systemexpertise1-Jan-09 18:26
systemexpertise1-Jan-09 18:26 
AnswerRe: Software development Pin
Cosmic Egg10-Jan-09 3:29
Cosmic Egg10-Jan-09 3:29 
QuestionStylesheet in VS2008 Pin
sarang_k30-Dec-08 19:01
sarang_k30-Dec-08 19:01 
AnswerRe: Stylesheet in VS2008 Pin
CodingYoshi4-Jan-09 15:45
CodingYoshi4-Jan-09 15:45 
QuestionException Hierarchy Pin
CodingYoshi29-Dec-08 11:27
CodingYoshi29-Dec-08 11:27 
GeneralRe: Exception Hierarchy Pin
Luc Pattyn29-Dec-08 15:12
sitebuilderLuc Pattyn29-Dec-08 15:12 
GeneralRe: Exception Hierarchy Pin
CodingYoshi30-Dec-08 3:18
CodingYoshi30-Dec-08 3:18 
AnswerRe: Exception Hierarchy Pin
Jon Rista6-Jan-09 8:48
Jon Rista6-Jan-09 8:48 
GeneralRe: Exception Hierarchy Pin
Leftyfarrell6-Jan-09 13:29
Leftyfarrell6-Jan-09 13:29 
GeneralRe: Exception Hierarchy Pin
Jon Rista6-Jan-09 17:31
Jon Rista6-Jan-09 17:31 
GeneralRe: Exception Hierarchy Pin
Curtis Schlak.25-Feb-09 9:02
Curtis Schlak.25-Feb-09 9:02 
AnswerRe: Exception Hierarchy Pin
Curtis Schlak.25-Feb-09 9:20
Curtis Schlak.25-Feb-09 9:20 
QuestionWho can show me the process and method of Scrum? Pin
Tal Rasha's Guardianship18-Dec-08 21:32
Tal Rasha's Guardianship18-Dec-08 21:32 
AnswerRe: Who can show me the process and method of Scrum? Pin
Ashfield18-Dec-08 22:01
Ashfield18-Dec-08 22:01 
GeneralRe: Who can show me the process and method of Scrum? Pin
Tal Rasha's Guardianship22-Dec-08 17:17
Tal Rasha's Guardianship22-Dec-08 17:17 
GeneralRe: Who can show me the process and method of Scrum? Pin
Ashfield26-Dec-08 22:40
Ashfield26-Dec-08 22:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.