New Posts New Posts RSS Feed: parent child insertion record with (Oracle)
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

parent child insertion record with (Oracle)

 Post Reply Post Reply
Author
Molinari View Drop Down
Groupie
Groupie
Avatar

Joined: 25-Aug-2010
Posts: 42
Post Options Post Options   Quote Molinari Quote  Post ReplyReply Direct Link To This Post Topic: parent child insertion record with (Oracle)
    Posted: 06-Sep-2010 at 4:11am
OK.

Thanks very much
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 03-Sep-2010 at 3:24pm
In theory choosing the right data type for properties in the CSDL is the responsibility of the Oracle provider, so check with Devart to see if this is a known problem or has a workaround.
Back to Top
Molinari View Drop Down
Groupie
Groupie
Avatar

Joined: 25-Aug-2010
Posts: 42
Post Options Post Options   Quote Molinari Quote  Post ReplyReply Direct Link To This Post Posted: 03-Sep-2010 at 1:39pm
I would like to ask one more thing...

Rather every time update a EDMX manually. Do you know any way that we can convert that decimal value to int. Automatically.

because the DB has more than 200 table.

you can not keep doing manually


Thanks...
Back to Top
Molinari View Drop Down
Groupie
Groupie
Avatar

Joined: 25-Aug-2010
Posts: 42
Post Options Post Options   Quote Molinari Quote  Post ReplyReply Direct Link To This Post Posted: 03-Sep-2010 at 1:24pm
Problem Solved.

Problem was in EDMX.

Thanks very much.....
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 03-Sep-2010 at 12:14pm
Your entities are not defined correctly.
 
VENDA.VENDAID should have the StoreGeneratedPattern attribute in both SSDL and CSDL.  This is the parent entity, and its ID is assigned by the database when a record is inserted.
 
ITEMVENDA.FK_VENDAID should not have the StoreGeneratedPattern attribute in either SSDL or CSDL.  This is a foreign key field, and the value will come via your code and DevForce, when you do something like anItemVenda.Venda = aVenda.
 
To make these changes you will likely need to manually edit the XML in the EDMX.
Back to Top
Molinari View Drop Down
Groupie
Groupie
Avatar

Joined: 25-Aug-2010
Posts: 42
Post Options Post Options   Quote Molinari Quote  Post ReplyReply Direct Link To This Post Posted: 03-Sep-2010 at 11:24am
hey i am uploding my EDMX

could you see the problem. please.

edmx.txt




Thanks by attention
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 03-Sep-2010 at 11:10am
DevForce is agnostic regarding the actual database and provider used, since all database access is done through the Entity Framework.  It's likely that the problem is with the provider, so please check both the CSDL and SSDL definitions of this entity in the EDMX to see that the StoreGeneratedPattern is set correctly on the ID property.  You can post or upload your EDMX here if you have any questions.
Back to Top
Molinari View Drop Down
Groupie
Groupie
Avatar

Joined: 25-Aug-2010
Posts: 42
Post Options Post Options   Quote Molinari Quote  Post ReplyReply Direct Link To This Post Posted: 03-Sep-2010 at 10:51am
Hi thanks for reply
My ID not always storing value 0

I am using Devart provider v5.60 for oracle.

Why I have problem with oracle and its working good with MS SQL Server
I am facing other problem of parent child insertion in oracle.

Is DevForce much not confirmtable with Oracle?

I testing and occurred this error :

A depended property in a ReferentialConstraint is mapped to a store-generated column. Column:FK_VENDAID!!!

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 03-Sep-2010 at 9:18am
Can you check the ITEMVENDA ID assignment after adding each entity - is the ID always 0? If so, then it sounds like the ID might not be recognized as an "auto-increment" or store-generated ID. 
 
In the CSDL section of your EDMX, check that the ID property for ITEMVENDA indicates it is store generated.  For example, it should look something like this:
          <Property Name="ITEMVENDA_ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
 
If the StoreGeneratedPattern is not in the entity definition in the CSDL, but is defined for the entity in the SSDL, then this is a problem with the EF Oracle provider.  Which provider are you using?
Back to Top
Molinari View Drop Down
Groupie
Groupie
Avatar

Joined: 25-Aug-2010
Posts: 42
Post Options Post Options   Quote Molinari Quote  Post ReplyReply Direct Link To This Post Posted: 03-Sep-2010 at 7:48am
Hi There

I catch up with other Database Problem.
I am working with parent and child and below code works fine with MS SQL SERVER
But Throwing Exception in Oracle

My aim is to Insert one record after another record.Its works fine when I insert single record
but if I try to insert another one getting error.

            var mgr = new Entities();
            for (int i = 0; i < 10; i++)
            {
               ITEMVENDA c = new ITEMVENDA() { NOME = "DEV " + i,   VALORUNIT = 11, FK_VENDAID = 43 };
               mgr.AddEntity(c);
            }
            mgr.SaveChangesAsync(op =>
            {
               if (op.IsCompleted)
                    MessageBox.Show("Sucess");
               else
                    MessageBox.Show(op.Error.Message);
            });

Excepyion:-   An entity with this key: ITEMVENDA: 0 already exists in this EntityManage
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down