Search found 4 matches

by AKhan
Fri 29 Oct 2010 14:35
Forum: dotConnect for Oracle
Topic: DeleteOnSubmit() doesn’t perform Delete on child objects.
Replies: 3
Views: 1910

I looked at different examples and codes for the delete, and I think i am doing every thing as suggested.
When DeleteOnSubmit is executed the entity is still attached and exist in both collection and table.

My issues is that i am calling DeleteOnSubmit on an inner Object (grandchild) of the main object (Customer), and it is part of the collection. The delete work on the first or 2nd level of objects but not at the deeper level.
by AKhan
Mon 18 Oct 2010 15:27
Forum: dotConnect for Oracle
Topic: DeleteOnSubmit() doesn’t perform Delete on child objects.
Replies: 3
Views: 1910

DeleteOnSubmit() doesn’t perform Delete on child objects.

We are having issues with physically deleting child records in a collection. Consider following Structure.
Customer -> ContactCollection - > ContactMethod Collection.
Customer has collection of Contacts and Contact has collection of ContactMethods. Bellow is something similar I am trying to do.


dbContext.DeferredLoadingEnabled = false;

dbContext.Customer.Attach(customer, originalCustomer);

foreach (Contact contact in customer.ContactCollection)
{
Var originalContact = getOriginalContact(contact.Id);
dbContext.Contacts.Attach(contact, originalContact);
foreach(ContactMethod method in contact.ContactMethodCollection)
{
Var originalConatactMethod = getOriginalContactMethod(method.Id);
If(method.DeleteItem)
{
dbContext.ContactMethods.Attach(method);
dbContext. ContactMethods.DeleteOnSubmit(method);
}
else
dbContext.ContactMethods.Attach(method, originalConatactMethod);
}
}
_ dbContext.SubmitChanges();


The code sample above doesn’t have statements for InsertOnSubmit() and it because Inser works fine for me. The code doesn’t throw any exception but even it run through the DeleteOnSubmit() Statement it doesn’t delete the record and neither does it run any Query for the Delete (checked using db monitor).

If I take out the Delete Statement and place it out side of the loop i.e. (directly delete the child without going throw each Contact and ContactMethod) it work just trigger delete statement.

Am I missing anything or is this not how DeleteOnSubmit should be used?
by AKhan
Wed 22 Sep 2010 18:43
Forum: dotConnect for Oracle
Topic: Using Numberic Value instead of TimeStamp
Replies: 1
Views: 1168

Using Numberic Value instead of TimeStamp

I am updating my entity by attaching it to the Context. I am trying to use IsVersion attribute on a Numeric column to be used for the concurrency control. But the column value doesn’t get incremented by itself and neither does it allow updating or inserting the value for that column.
Do we have to use TimeStamp for concurrency control. Can we just create a Numeric column and set it IsVersion = true. Will this auto increment the value on Update?


[Column(Name = @"_MyVERSIONRow", Storage = "_MyVersionRow", CanBeNull = false, DbType = "NUMBER(5) NOT NULL")]
public int myVersionRow
{
get
{
return this._MyRowVersion;
}
set
{
if (this._MyRowVersion != value)
{
this._MyRowVersion = value;
}
}
}
by AKhan
Wed 22 Sep 2010 17:23
Forum: dotConnect for Oracle
Topic: How to convert sql server timestamp to oracle
Replies: 3
Views: 1956

Using Numberic Value instead of TimeStamp

Do we have to use TimeStamp for concurrency control. Can we just create a Numeric column and set it IsVersion = true. And if we do that will this auto increment the value on Update?