-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I was told in L2S, the code for update and insert are the same,
db.InsertOnSubmit(row);
db.SubmitChanges();
and L2S will check to see if it is a insert or update and act approprately in the background.
Is that true?
How about L2E? I tested, looks like in L2E it is not like that. Maybe I did…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I have four tables:
Users PrivilegeGroups rdPrivileges LinkPrivilege
----------- ---------------- --------------- ---------------
userId(pk) privilegeGroupId(pk) privilegeId(pk) privilegeId(pk, fk)
privilegeGroupId(fk) name …
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I am using .Net3.5. Just wondering my understanding about the insert, update, delete are correct when use L2E.
For insert, we need two statements:
context.AddObject("entityName", newRow);
context.SaveChanges();
For update, we only need one statement:
context.SaveChanges();
For delete, we need…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I have following code to delete an user from database:
try
{
var user = from u in db.Users
where u.Username == username
select u;
if (user.Count() > 0)
{
db.DeleteObject(user…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
The following code will select a key/value table in the DB and will save the result to the cache:
using (var db = new TestEntities())
{
if(Cache["locName_" + inventoryLocationName] != null)
return Cache["locName_" + inventoryLocationName];
var location =
db.InventoryLocationsSet…
>>> More