Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

DML on DB Tables ?

$
0
0

Hi i tried first time the ORM but i run into a Problem i can´t find a answer yet.

I have 2 Tables Lookup and Aspect , Lookup has PK is parent and  Aspect is child table  (1:n)

i created the EntitiesModel as described created a DTO (less Columns) map data to it and

fill a RadGridView then catch the Delete Event from RadGridView . Until here all works fine.

But then i tried a Delete

            _selected_id = ((LookupDto)(((object[])(((GridViewDeletedEventArgs)(arg)).Items))[0])).lookup_lkp;
            Lookup _retlookup = this._dbcontext.Lookups.Where( c => c.lookup_lkp == _selected_id ).FirstOrDefault();
            _dbcontext.AttachCopy(_retlookup);
            _dbcontext.Delete(_retlookup);

and this also has no runtime  problem until i execute ( save button ) 

_dbcontext.SaveChanges();

then the ORM failing and tell me in the Logging  ( i deleted a lookup with PK = AAA )

Instance: GenericOID@e22ce1 Lookup lookup_lkp=AAA
DELETE FROM [lookup_aspect] WHERE [lookup_lkp] = ?

and this fails because there is no [lookup_aspect] table ?

I also could not find the string searching the hole Project. So it must be build in ORM anywhere based on a "rule".

Generated Lookup Class looks like 

    [Table("lookup")]
    [ConcurrencyControl(OptimisticConcurrencyControlStrategy.Changed)]
    [System.ComponentModel.DisplayName("")]
    [System.Serializable()]
    public partial class Lookup : IDataErrorInfo, INotifyPropertyChanging, INotifyPropertyChanged, System.Runtime.Serialization.ISerializable
    {
        ....

    }

    and aspect 

    [Table("aspect")]
    [ConcurrencyControl(OptimisticConcurrencyControlStrategy.Changed)]
    [KeyGenerator(KeyGenerator.Guid)]
    [System.ComponentModel.DisplayName("")]
    [System.Serializable()]
    public partial class Aspect : IDataErrorInfo, INotifyPropertyChanging, INotifyPropertyChanged, System.Runtime.Serialization.ISerializable
    {
        ....

    }

 

 why is there this strange behaviour and where could i disable it ?

thanks br thomas

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

 


Viewing all articles
Browse latest Browse all 94857

Latest Images

Trending Articles



Latest Images