This is a migrated thread and some comments may be shown as answers.

ID mapping type

2 Answers 45 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
marco
Top achievements
Rank 1
marco asked on 21 Apr 2010, 08:34 AM
Hi have created the class

category.id
category.name

i map the class to the table cateogires.

the id in the table is a char(10)
in the application i have this code:

Category cat = new Category();
            cat.Id = "tel";
            cat.Name = "Teler";
            scope.Add(cat);
            scope.Transaction.Commit();

in the db the orm not save the correct value for the id.
it use a autoincrement.

2 Answers, 1 is accepted

Sort by
0
marco
Top achievements
Rank 1
answered on 21 Apr 2010, 08:42 AM
if i submit 2 times the page that create a new categroy and save the category in the db i get this error.

Instance of 'DomainLib.Category' with identity '1122624262-tel' already exists in the cache of the object scope.


it is correct because i try to insert 2 times a category with the same id.
but in the db i have no categoryes with id = "tel" 
each row in the db table has a number as id. (50,51,52,53,54,55....)
( cat.Id = "tel"; )


0
marco
Top achievements
Rank 1
answered on 21 Apr 2010, 09:28 AM
Sorry, was a problem with oracle.
Is all ok!

Tags
General Discussions
Asked by
marco
Top achievements
Rank 1
Answers by
marco
Top achievements
Rank 1
Share this question
or