Prev | Current Page 161 | Next

Satheesh, N Kumar

"LINQ Quickly"

If I execute the same query three times, it will return the three result-sets
with three instances.
In LINQ to SQL, we use DataContext for referring to the database objects. Here,
DataContext is an object which is supposed to have object identity. Whenever
a new row is fetched from the database through DataContext, it is logged in an
identity table and a new object will be created. If the same row is fetched again, the
DataContext will take care of sending the same instance of the object created at the
first time. So the identity table is a cache table which will provide the object instances
if the same object has already been created.
LINQ to SQL
[ 100 ]
Queries with Multiple Entities
In the previous examples, we have seen classes with a collection of classes. For
example, the Categories entity class has a collection of Items class. This kind of
relationship builds the foreign key relationship at the database level. Normally in
SQL queries, we have to refer to these two objects when we need a join operation for
the query.


Pages:
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
szkolenia bhp warszawa Jaki wybrać olej życzenia z okazji urodzin niderlandy wierszyki