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

Problem with insert on many-to-many

20 Answers 403 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.
Daniel Plomp
Top achievements
Rank 2
Daniel Plomp asked on 19 Nov 2010, 10:27 PM
Hi all,

I have this weird problem of not getting a record inside a Join table in my database.
I have 'Participant' and 'Role' connected through 'ParticipantRole'.

My model shows only 2 tables, which is correct. (ZeroMany - ZeroMany)

When I execute the following code, nothing happens?

/// <summary>
/// Add a Participant to a specific Role
/// </summary>
/// <param name="rolename"></param>
/// <param name="email"></param>
public void AddParticipantToRole(string rolename, string email)
{
   try
   {
      Role r = context.Roles.Where(x => x.Description == rolename).FirstOrDefault();
      Participant pa = context.Participants.Where(x => x.Email == email).FirstOrDefault();
      pa.Roles.Add(r);
      context.SaveChanges();
   }
   catch (Exception ex)
   {
      throw ex;
   }
}

The table is not beeing filled.
I downloaded the latest version of OpenAccess, updated my model, checked the relations between my tables and associations between my entities, but nothing works.

What should I do?

Thanks!
Daniel

20 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 22 Nov 2010, 04:49 PM
Hello Daniel,

Such behavior is observed when the association is not declared as "managed". If it is managed, adding a Role object to the Participants collection or adding Participant objects to the Roles collection should have the same effect. On the other hand, when the association is not managed, adding related objects is possible in only one of the directions. So the solution in your case would be to modify the code the following way:
Role r = context.Roles.Where(x => x.Description == rolename).FirstOrDefault();
Participant pa = context.Participants.Where(x => x.Email == email).FirstOrDefault();
//pa.Roles.Add(r);
r.Participants.Add(pa);
context.SaveChanges();

A question that you might ask is that why all associations are not managed by default. Actually they were, prior to Q2, but we found out that this could lead to decreased performance when working with large databases, containing hundreds of thousands of objects participating in such relationships. That is why we decided to create the associations as not managed by default. This could be changed from the Details Editor when the association is selected. However, I just verified that this option is not set correctly for m:n associations and we will have to fix this. So the workaround at the moment is to use the code above. Hope it helps.

Regards,
Alexander
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
0
francesco
Top achievements
Rank 2
answered on 22 Feb 2011, 11:26 AM
Hi Alexander,
   i had the same problem described by Daniel and i used your workaround. Will Telerik fix this problem on the next release?

Thanks
  Francesco
0
Alexander
Telerik team
answered on 23 Feb 2011, 08:03 AM
Hi francesco,

Yes, this will be fixed in the 2011 Q1 release which is scheduled for the middle of March.

All the best,
Alexander
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Tajes
Top achievements
Rank 1
answered on 11 Mar 2011, 12:15 PM
Hello, 
I have a similar issue. I'm using Open Access Visual Designer. I have enabled manage for a many to many relation, however the relation can be set only by one way.
Taking previous example:

Role r = context.Roles.Where(x => x.Description == rolename).FirstOrDefault();
    Participant pa = context.Participants.Where(x => x.Email == email).FirstOrDefault();
    //pa.Roles.Add(r); --> don't do anything
    r.Participants.Add(pa); //--> this works
    context.SaveChanges();

    Why this behavior, if I have enabled manage in the relation?
0
Clement
Top achievements
Rank 1
answered on 15 Mar 2011, 10:00 AM
I have a M:N problem. I'm using Telerik 2010 Q3 purchased by my client. I need to have a many to many relationship between Scheme and Town.
I've created a join table in database called Scheme_towns and did a reverse mapping using OA which in turn generated a scheme_town collection and other related configurations.

In Scheme and town classes I added
[Telerik.OpenAccess.FieldAlias("schemeSystemTown")]
       public IList<SchemeSystem> SchemeSystemstown
       {
           get { return schemeSystemTown; }
       }
in town class and
[Telerik.OpenAccess.FieldAlias("schemeTowns")]
        public IList<Town> SchemeTown
        {
            get { return schemeTowns; }
 
 
        }
for Scheme Class.

In the UI, when registering Schemes, I select a  pre-registered towns that belong to the scheme ( one town can be in more than one scheme) from a checked combobox. When I save, data is entered in the join table. problem is instead of saving town_id for the town that i selected, it generates a new town_id that is saved in the join table together with the id for the current scheme. It also proceeds to add this town_id into the towns table, with a null for the town name since I'm not registering the town at this point.

How do I make it to save the town_id for the selected town in join table and also not to create a new town int towns table?
0
Alexander
Telerik team
answered on 17 Mar 2011, 01:41 PM
Hello,

I am glad to notify you that the problem has been resolved in the newly uploaded Q1 release. In order to enable the Managed option for a many to many association, just open the designer, select the association in question and from the Properties pane enable the IsManaged option for the target member.

@Clement: Let's please continue the conversation in your other thread on this topic, it seems the problem is a bit different and will need more investigation.

All the best,
Alexander
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Chuck
Top achievements
Rank 1
answered on 12 Aug 2011, 09:33 PM
Hi - I am having the same problem, only updating in one direction.  This is with Q2 2011.  I have set the target member to Managed.

Also can you please describe the IsDependent property?  The documentation is not very descriptive: "Specifies that this navigation property is dependent. "
0
IT-Als
Top achievements
Rank 1
answered on 15 Aug 2011, 07:51 AM
Hi Chuck (and others listening),

IsDependent is a way to tell that an object instance or a list of objects) that it is dependent on the object it is contained in.

Example (classic approach) but it is the same in the Context / Visual Designer approach:

public class Customer
{
        ......
        [Telerik.OpenAccess.Depend()]
        private PayoutOptions payoutOption;
        ......
}

So the payoutOption field is dependent on the Customer instance it is contained in. So when the Customer is disposed the instance referenced by the payoutOption field is also disposed by OpenAccess...  You can think of it as a "SQL cascading delete" kind of thing.

As mentioned earlier this is also possible to do with lists (IList<Whatever> for example) of objects...

Regards

Henrik

0
Chuck
Top achievements
Rank 1
answered on 15 Aug 2011, 02:42 PM
Henrik:  Got it.  Thanks for the explanation.
0
Jörg
Top achievements
Rank 1
answered on 01 Mar 2012, 03:19 PM
Hi.

I have also a problem with inserting in on man-to-many tables..

I have the following tables (see picture).

The IsManged property is set to true for both navigation properties (Sector and Door)
For tests I use this code

public void TestManToMany()
{
    using (DbContext ctx = new DbContext())
    {
        int nr = 30;
 
        Sector sector = new Sector()
        {
            AId = 1,
            Desc = "bla",
            Name = "Sector " + nr,
            Path = "",
            SectorId = nr,
 
        };
 
        Door door = new Door()
        {
            DoorId = nr + 1000,
            Name = "Door " + nr,
            RoomNr = nr.ToString(),
        };
 
        sector.Doors.Add(door);
        //door.Sectors.Add(sector);
 
        ctx.Add(door);
        ctx.Add(sector);
        ctx.SaveChanges();
    }
}

I get the following exception:
Sorry, but I have only a German system. There is conflict between with the foreign key FK_tblDoor_tblSector in table Sector.
This foreign key constraint defines only the association between the Sector and the DoorSector table. I have check it and the definition of the constraint is ok.

Telerik.OpenAccess.Exceptions.DataStoreException was unhandled
  Message=Insert link table row failed: Telerik.OpenAccess.RT.sql.SQLException: Die INSERT-Anweisung steht in Konflikt mit der FOREIGN KEY-Einschränkung 'FK_tblDoorSector_tblSector'. Der Konflikt trat in der lsmdb-Datenbank, Tabelle 'dbo.tblSector' auf.
Die Anweisung wurde beendet.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()
   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()
   at OpenAccessRuntime.Relational.metadata.RelationalLinkCollectionField.insertUnorderedLinkTableRows(OID oid, Object[] inserted, PreparedStatement psins, Boolean batch, String sql)
Field: System.Collections.Generic.IList`1[[OpenAccessModel1.Sector, OpenAccessModel1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] OpenAccessModel1.Door._sectors
Instance: NewObjectOID@3 classIndex = 2 id = 1 realOID = GenericOID@408 Door colDoorId=1030
Value: NewObjectOID@2 classIndex = 0 id = 2 realOID = GenericOID@1f Sector colAId=1/colSectorId=30
INSERT INTO [tblDoorSector]([colDoorId], [colSectorId], [colAId]) VALUES (?, ?, ?)
(set event logging to all to see parameter values) Telerik.OpenAccess.RT.sql.SQLException: Die INSERT-Anweisung steht in Konflikt mit der FOREIGN KEY-Einschränkung 'FK_tblDoorSector_tblSector'. Der Konflikt trat in der lsmdb-Datenbank, Tabelle 'dbo.tblSector' auf.
Die Anweisung wurde beendet.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()
   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()
   at OpenAccessRuntime.Relational.metadata.RelationalLinkCollectionField.insertUnorderedLinkTableRows(OID oid, Object[] inserted, PreparedStatement psins, Boolean batch, String sql)
  Source=Telerik.OpenAccess
  CanRetry=false
  StackTrace:
       at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
       at OpenAccessRuntime.ExceptionWrapper.Throw()
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x)
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.internalCommit(Boolean phase)
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.commit()
       at OpenAccessRuntime.EnlistableObjectScope.CommitChanges()
       at Telerik.OpenAccess.OpenAccessContextBase.SaveChanges(ConcurrencyConflictsProcessingMode failureMode)
       at Telerik.OpenAccess.OpenAccessContextBase.SaveChanges()
       at OpenAccessModel1.Dal.TestManToMany() in D:\Users\multhaupj\Documents\Visual Studio 2010\Projects\OpenAccessORMTest5\OpenAccessModel1\Dal.cs:line 84
       at ConsoleApplicationTest.Program.Main(String[] args) in D:\Users\multhaupj\Documents\Visual Studio 2010\Projects\OpenAccessORMTest5\ConsoleApplicationTest\Program.cs:line 14
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: Telerik.OpenAccess.RT.sql.SQLException
       Message=Die INSERT-Anweisung steht in Konflikt mit der FOREIGN KEY-Einschränkung 'FK_tblDoorSector_tblSector'. Der Konflikt trat in der lsmdb-Datenbank, Tabelle 'dbo.tblSector' auf.
Die Anweisung wurde beendet.
       Source=Telerik.OpenAccess.Runtime
       Description=SQLState=;Die INSERT-Anweisung steht in Konflikt mit der FOREIGN KEY-Einschränkung 'FK_tblDoorSector_tblSector'. Der Konflikt trat in der lsmdb-Datenbank, Tabelle 'dbo.tblSector' auf.
Die Anweisung wurde beendet.
       ErrorCode=547
       Number=547
       StackTrace:
            at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()
            at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()
            at OpenAccessRuntime.Relational.metadata.RelationalLinkCollectionField.insertUnorderedLinkTableRows(OID oid, Object[] inserted, PreparedStatement psins, Boolean batch, String sql)
       InnerException: 


I tried also another way to test this.

...
ctx.Add(door);
ctx.Add(sector);
ctx.SaveChanges();
 
var sec = ctx.Sectors.SingleOrDefault(s => s.SectorId == sector.SectorId);
var doo = ctx.Doors.SingleOrDefault(d => d.DoorId == door.DoorId);
 
sec.Doors.Add(doo);
ctx.SaveChanges();
...

But with the second SaveChanges I get the same exception as above.

What could be the problem, Why I cannot insert data to the join table ???

I'm using the latest version of Open Access ORM (2012.1.214.1), Visual Studio 2010 SP1, .Net4, Win7 64bit.

Best regards
Jörg


 
0
Chuck
Top achievements
Rank 1
answered on 01 Mar 2012, 03:34 PM
I am not sure that composite keys are supported, and it looks like that is what your sectors table is using.  This may be the main problem.

Secondly,

You shouldn't need to explictly add the door to the context.  It is automatically added when you add it to the sector.  Try removing:


ctx.Add(door);

Then add back in:

    door.Sectors.Add(sector);


Personally, I think this shouldn't be needed, but in reality I have experienced very inconsistant behavior unless you specify both sides of the relationship, and so it is now our practice to always include both objects in each others list.
0
Jörg
Top achievements
Rank 1
answered on 01 Mar 2012, 03:41 PM
Hi Chuck,

thanks for the quick reply.

I have change the code to

sector.Doors.Add(door);
//door.Sectors.Add(sector);
 
//ctx.Add(door);
ctx.Add(sector);
ctx.SaveChanges();
 An I set the IsManaged value for the sector list in the door object to false, so only the Door list of the sector object is managed yet.

But I get the same exception.

regards
Jörg
0
Chuck
Top achievements
Rank 1
answered on 01 Mar 2012, 03:44 PM
Thanks for the try.  After looking at your DB diagram I edited my original reply.  I think the problem is the composite key.
0
IT-Als
Top achievements
Rank 1
answered on 01 Mar 2012, 04:26 PM
Hi you both,

For a consistent change tracking (that's what goes on when relationsships are managed) I experienced superb results by adding the object to the Context just after I new'ed it..

Like:

Model.Order pOrder = new Model.Order();
Context.Add(pOrder);
// OA "knows" about the Order instance now... thus can track it... and the objects you decide to add to associations
Model.OrderLine pOrderLine = new Model.OrderLine();
pOrder.Add(pOrderLine);

So if you do:

Sector sector = new Sector();
ctx.Add(sector);
Door door = new Door();
sector.Doors.Add(door);

in that order.. I am almost sure it works.. Let me know..

/ Henrik
0
Chuck
Top achievements
Rank 1
answered on 01 Mar 2012, 04:42 PM
Henrik,

The following:

sector.doors.add(door)
door.sectors.add(sector)
context.add(sector)

Works for me 100% of the time, but I did not understand why the "door.sectors.add(sector)" was needed.  Now it makes perfect sense.  Until "sector" was added to the context it is still just a POCO and cannot be managed.  The reason I experienced "inconsistancy", was there were probably times I was working with existing objects that had already been added to the context.

Thanks for the clearing it up, makes perfect sense now.  I still don't think it will help Jörg, maybe this will:

http://www.telerik.com/help/openaccess-orm/object-identity-multiple-field.html

It looks like the composite key is supported, just with more work involved.
0
Ralph Waldenmaier
Telerik team
answered on 02 Mar 2012, 02:55 PM
Hi,

First I'd like to thank Henrik for the good explanation. 

I reproduced this and got this example working with the upcoming Service Pack to be released soon:

Random random = new Random();
using (EntitiesModel ctx = new EntitiesModel())
{
    var door = new Door() { Id = random.Next(), Property1 = "SomeValue" };
    var sector = new Sector() { Id = random.Next(), Id2 = random.Next() };
 
    ctx.Add(door);
    door.Sectors.Add(sector);
    ctx.SaveChanges();
}

In my case the Sector class has the multiple id specified.
When the door object is added to the Context, it is sufficient to just add the sector object to the collection of sectors on the door object. The sector object will implicitly added to the Context. Hence the collections must be managed, in order to get this done.


I hope this information is useful for you. Feel free to ask if you have any other question.
Regards,
Ralph
the Telerik team
Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
0
Jörg
Top achievements
Rank 1
answered on 14 Mar 2012, 11:30 AM
Hello.

Thanks for all your replies.

I have installed the latest version of ORM and tried the suggestion from Ralph.

I have the following code:
var area1 = dataAccessLayer.GetAreaById(1);
 
Sector newSector = null;
 
if (area1 != null)
{
 
    newSector = new Sector()
    {
        AId = area1.AId,
        Desc = "description",
        Name = "sector name",
        Path = "",
        SectorId = nr,
    };
 
    Door newDoor = new Door()
    {
        DoorId = nr + 1000,
        Name = "door name" + nr,
        RoomNr = nr.ToString(),
    };
 
 
    dataAccessLayer.InsertSectorDoor(newSector, newDoor);
 
and in the data access layer I use the following code:

public void InsertSectorDoor(Sector sector, Door door)
{
    using (DbContext ctx = GetContext())
    {
        ctx.Add(sector);
        sector.Doors.Add(door);
        ctx.SaveChanges();
    }
 
}

I get the following exception:

The INSERT-Command is in conflict with a FOREIGN-Key constraint.


Telerik.OpenAccess.Exceptions.DataStoreException was unhandled
  Message=Insert link table row failed: Telerik.OpenAccess.RT.sql.SQLException: Die INSERT-Anweisung steht in Konflikt mit der FOREIGN KEY-Einschränkung 'FK_tblDoorSector_tblSector'. Der Konflikt trat in der lsmdb-Datenbank, Tabelle 'dbo.tblSector' auf.
Die Anweisung wurde beendet.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()
   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()
   at OpenAccessRuntime.Relational.metadata.RelationalLinkCollectionField.insertUnorderedLinkTableRows(OID oid, Object[] inserted, PreparedStatement psins, Boolean batch, String sql)
Field: System.Collections.Generic.IList`1[Lsm.BusinessObjects.Model.Sector,Lsm.BusinessObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] Lsm.BusinessObjects.Model.Door._sectors
Instance: NewObjectOID@7 classIndex = 5 id = 2 realOID = GenericOID@428 Door colDoorId=1035
Value: NewObjectOID@7 classIndex = 6 id = 1 realOID = GenericOID@8 Sector colAId=1/colSectorId=35
INSERT INTO [tblDoorSector]([colDoorId], [colSectorId], [colAId]) VALUES (?, ?, ?)
(set event logging to all to see parameter values) Telerik.OpenAccess.RT.sql.SQLException: Die INSERT-Anweisung steht in Konflikt mit der FOREIGN KEY-Einschränkung 'FK_tblDoorSector_tblSector'. Der Konflikt trat in der lsmdb-Datenbank, Tabelle 'dbo.tblSector' auf.
Die Anweisung wurde beendet.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()
   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()
   at OpenAccessRuntime.Relational.metadata.RelationalLinkCollectionField.insertUnorderedLinkTableRows(OID oid, Object[] inserted, PreparedStatement psins, Boolean batch, String sql)
  Source=Telerik.OpenAccess
  CanRetry=false
  StackTrace:
       at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
       at OpenAccessRuntime.ExceptionWrapper.Throw()
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x)
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.internalCommit(Boolean phase)
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.commit()
       at OpenAccessRuntime.EnlistableObjectScope.CommitChanges()
       at Telerik.OpenAccess.OpenAccessContextBase.SaveChanges(ConcurrencyConflictsProcessingMode failureMode)
       at Telerik.OpenAccess.OpenAccessContextBase.SaveChanges()
       at SimonsVoss.Lsm.Dal.Dal.InsertSectorDoor(Sector sector, Door door) in D:\Users\multhaupj\Documents\Visual Studio 2010\Projects\SimonsVoss.Lsm.Example\SimonsVoss.Lsm.Dal\Dal.cs:line 132
       at SimonsVoss.Lsm.TestApp.Program.Main(String[] args) in D:\Users\multhaupj\Documents\Visual Studio 2010\Projects\SimonsVoss.Lsm.Example\SimonsVoss.Lsm.TestApp\Program.cs:line 76
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: Telerik.OpenAccess.RT.sql.SQLException
       Message=Die INSERT-Anweisung steht in Konflikt mit der FOREIGN KEY-Einschränkung 'FK_tblDoorSector_tblSector'. Der Konflikt trat in der lsmdb-Datenbank, Tabelle 'dbo.tblSector' auf.
Die Anweisung wurde beendet.
       Source=Telerik.OpenAccess.Runtime
       Description=SQLState=;Die INSERT-Anweisung steht in Konflikt mit der FOREIGN KEY-Einschränkung 'FK_tblDoorSector_tblSector'. Der Konflikt trat in der lsmdb-Datenbank, Tabelle 'dbo.tblSector' auf.
Die Anweisung wurde beendet.
       ErrorCode=547
       Number=547
       StackTrace:
            at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()
            at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()
            at OpenAccessRuntime.Relational.metadata.RelationalLinkCollectionField.insertUnorderedLinkTableRows(OID oid, Object[] inserted, PreparedStatement psins, Boolean batch, String sql)
       InnerException: 


Any ideas?

Best regards
Jörg
0
Damyan Bogoev
Telerik team
answered on 16 Mar 2012, 03:03 PM

Hi Jörg,

It seems that the association between the Sector and the Door classes is not marked as managed. In order to achieve that please do the following steps:

1. Select the association from the visual designer;
2. Press F4 to open the Properties Grid window;
3. Expand the Target Property tree node and set the Is Managed to True;
4. Expand the Source Property tree node and set the Is Managed to True;
5. Save the diagram and rebuild the solution;

Hope that helps.

All the best,
Damyan Bogoev
the Telerik team
Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
0
Brad
Top achievements
Rank 1
answered on 12 Apr 2013, 08:31 PM
I just ran into this issue today too and it took a while figure out, but thankfully this thread helped me figure out that I just had to set IsManaged to true on the Target Property of the association.  Why is this not the default.  It seems to me that this would be the desired action the majority of the time.
0
Doroteya
Telerik team
answered on 17 Apr 2013, 02:39 PM
Hello Brad,

Thank you for the feedback.

Indeed, setting isManaged to true is applicable in a lot of scenarios. There are, however, scenarios where that is simply unnecessary and may cause a slower performance. Given that, we decided the default setting to be false and allowed the developers to change it whenever they find it feasible.

I hope that helps. If you have additional questions, do not hesitate to get back to us.


All the best,
Doroteya
the Telerik team
Using Encrypted Connection Strings with Telerik OpenAccess ORM. Read our latest blog article >>
Tags
General Discussions
Asked by
Daniel Plomp
Top achievements
Rank 2
Answers by
Alexander
Telerik team
francesco
Top achievements
Rank 2
Tajes
Top achievements
Rank 1
Clement
Top achievements
Rank 1
Chuck
Top achievements
Rank 1
IT-Als
Top achievements
Rank 1
Jörg
Top achievements
Rank 1
Ralph Waldenmaier
Telerik team
Damyan Bogoev
Telerik team
Brad
Top achievements
Rank 1
Doroteya
Telerik team
Share this question
or