Problem with a property not mapped in DataContext

Problem with a property not mapped in DataContext

Postby malea » Wed 10 Jul 2013 09:00

Hello,

I have a problem with a partial class that implements one property.

In my case, I have a table mapped in a datacontext, so I obtain the self-generated MyDataContext.MYTABLE.cs class.

And I have a partial class with one property more. This property it's not mapped becouse I only use it internally in my app.

Code: Select all
public partial class MYTABLE
{
    private string _PROPERTY_0;
   
    public string PROPERTY_0
    {
        get { return _PROPERTY_0; }
        set
        {
            if (_PROPERTY_0 != value)
            {
                SendPropertyChanging("PROPERTY_0");
                _PROPERTY_0 = value;
                SendPropertyChanged("PROPERTY_0");
            }
        }
    }
}


On dotConnect for Oracle v5.70 this code works perfect.

But with last version, events "SendProperty..." give me a System.InvalidOperationException "Sequence contains no elements".
This only happens with properties that are not mapped and are implemented in a partial class.
I have commented the lines that throws the events to solve the problem but I'm not sure if it is a good idea.

The stacktrace:
Code: Select all
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at Devart.Data.Linq.Engine.c7.b(Object A_0, PropertyChangingEventArgs A_1)
   at FranceDataContext.MYTABLE.SendPropertyChanging(String propertyName) in ...


Sorry for my English.
malea
 
Posts: 33
Joined: Fri 25 Jan 2013 08:25

Re: Problem with a property not mapped in DataContext

Postby MariiaI » Wed 10 Jul 2013 13:17

Thank you for the report. We have reproduced this issue. We will investigate it and inform you about the results as soon as possible.

I have commented the lines that throws the events to solve the problem but I'm not sure if it is a good idea.

It is OK. You could give the definition for your partial class in the following way:
Code: Select all
public partial class MYTABLE
{
    public string PROPERTY_0
    { get; set;}
}
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Problem with a property not mapped in DataContext

Postby malea » Wed 10 Jul 2013 14:09

Thank you.
I will define the property as you said and I will wait for more info.
malea
 
Posts: 33
Joined: Fri 25 Jan 2013 08:25

Re: Problem with a property not mapped in DataContext

Postby MariiaI » Fri 19 Jul 2013 06:44

The bug related to the "Sequence contains no elements" exception when working with unmapped properties and PropertyChanging/PropertyChanged events is fixed.
New version of dotConnect for Oracle 7.8 is released!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=1&t=27556.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Problem with a property not mapped in DataContext

Postby malea » Fri 19 Jul 2013 07:00

Thank you for the info.
I'm downloading it.
malea
 
Posts: 33
Joined: Fri 25 Jan 2013 08:25


Return to dotConnect for Oracle