This question is locked. New answers and comments are not allowed.
I'm developing a Silverlight application and I'm using Telerik's ORM and Silverlight components.
Obviously, I have several objects that are related to another ones, and in order to get those objects "connected" and accessible from each other I've defined some persistence classes.
Example, I have the table DocumentosReuniao (MeetingDocuments) and EstadosDocumento (DocumentState):
PS: I've not posted the other fields in order to focus on a specific example:
[Table("DOCUMENTOS_REUNIAO")]
[KeyGenerator(KeyGenerator.Autoinc)]
public partial class DocumentosReuniao
{
private long _Id;
[Column("ID", OpenAccessType = OpenAccessType.Decimal, IsBackendCalculated = true, IsPrimaryKey = true, Length = 22, SqlType = "NUMBER")]
[Storage("_Id")]
public virtual long IdProp
{
get
{
return this._Id;
}
set
{
this._Id = value;
}
}
[...]
private long _Estadodocumentoid;
[Column("ESTADO_DOCUMENTO_ID", OpenAccessType = OpenAccessType.Decimal, Length = 22, SqlType = "NUMBER")]
[Storage("_Estadodocumentoid")]
public virtual long EstadoDocumentoIdProp
{
get
{
return this._Estadodocumentoid;
}
set
{
this._Estadodocumentoid = value;
}
}
private EstadosDocumento _Estadosdocumento;
[ForeignKeyAssociation(ConstraintName = "DR_ED_FK", SharedFields = "EstadoDocumentoIdProp", TargetFields = "IdProp")]
[Storage("_Estadosdocumento")]
public virtual EstadosDocumento EstadosdocumentoProp
{
get
{
return this._Estadosdocumento;
}
set
{
this._Estadosdocumento = value;
}
}
}
and
[Table("ESTADOS_DOCUMENTO")]
[KeyGenerator(KeyGenerator.Autoinc)]
public partial class EstadosDocumento
{
private long _Id;
[Column("ID", OpenAccessType = OpenAccessType.Decimal, IsBackendCalculated = true, IsPrimaryKey = true, Length = 22, SqlType = "NUMBER")]
[Storage("_Id")]
public virtual long IdProp
{
get
{
return this._Id;
}
set
{
this._Id = value;
}
}
[...]
private IList<DocumentosReuniao> _Documentosreuniaos = new List<DocumentosReuniao>();
[Collection(InverseProperty = "EstadosdocumentoProp")]
[Storage("_Documentosreuniaos")]
public virtual IList<DocumentosReuniao> DocumentosReuniaos
{
get
{
return this._Documentosreuniaos;
}
}
}
And the Persistence Metadata class:
[MetadataTypeAttribute(typeof(DocumentosReuniao.DocumentosReuniaoMetadata))]
public partial class DocumentosReuniao
{
internal sealed class DocumentosReuniaoMetadata
{
[Key]
public long IdProp { get; set; }
[...]
//ESTADOS_REUNIAO
[Association("EstadoDocumento_DocumentoReuniao", "EstadoDocumentoIdProp", "IdProp")]
[Include]
public EstadosDocumento EstadosdocumentoProp { get; set; }
}
}
What happends, is when I'm editing a DocumentoReuniao object through a silverlight radDataForm:
PS: Again, I've not posted all object attributes because they would only add confusion:
<telerik:RadDataForm x:Name="frmDocumentoReuniao" AutoGenerateFields="False"
CommandButtonsVisibility="{Binding Path=DataContext.UtilizadorOperadorAdministrador, Converter={StaticResource BooleanToCommandVisibility}, ElementName=LayoutRoot}"
ValidationSummaryVisibility="Collapsed"
ReadOnlyTemplate="{StaticResource LeituraDocumentoReuniao}" EditTemplate="{StaticResource EditarDocumentoReuniao}"
CurrentItem="{Binding Path=DataContext.DocumentoReuniaoSeleccionado,Mode=TwoWay,ElementName=LayoutRoot}"
Visibility="{Binding ExisteDocumentoReuniaoSeleccionado, Converter={StaticResource ConverteBooleanParaVisibilidade}}">
</telerik:RadDataForm>
and the fields that control the actual relation between the two objects:
ReadOnlyMode:
<TextBlock Text="Estado Doc.:"
FontWeight="Bold" FontSize="11" HorizontalAlignment="Left" VerticalAlignment="Center"
Grid.Column="2" Grid.Row="2" Margin="2,0"
telerik:StyleManager.Theme="{Binding Path=DataContext.Tema, ElementName=LayoutRoot}"/>
<TextBlock Text="{Binding EstadosdocumentoProp.DesignacaoProp}" MaxWidth="220"
Grid.Column="3" Grid.Row="2"
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,0"
telerik:StyleManager.Theme="{Binding Path=DataContext.Tema, ElementName=LayoutRoot}"/>
EditMode:
<TextBlock Text="Estado Doc.:"
FontWeight="Bold" FontSize="11" HorizontalAlignment="Left" VerticalAlignment="Center"
Grid.Column="2" Grid.Row="2" Margin="2,0"
telerik:StyleManager.Theme="{Binding Path=DataContext.Tema, ElementName=LayoutRoot}"/>
<telerik:RadComboBox x:Name="lstEmVotacao"
ItemsSource="{Binding Path=DataContext.OCEstadosDocumento, ElementName=LayoutRoot}"
SelectedItem="{Binding EstadosdocumentoProp, Mode=TwoWay}"
DisplayMemberPath="DesignacaoProp"
HorizontalAlignment="Left" VerticalAlignment="Center" Width="110" MaxWidth="130" Margin="2,0"
Grid.Column="3" Grid.Row="2"
Cursor="Hand">
</telerik:RadComboBox>
Ok, now, the application scenario can be seen in the attached files appscenario 0.png, appscenario 1.png , appscenario 2.png
I chose to edit the object, then change the EstadoDocumento Property in the radComboBox and then CANCEL the change I've made..
As you can see in the appscenario 3.png attached file, the binded value remains the last choice from the radComboBox... I've made the test with other attributes (non other object referenced ones) and got the changes I've made ignore like it should be...
I leave you the debug time values of the EditEnded event of the radDataForm with the attached files: formeditended.png , object state.png and objectstate in context.png .
I've checked my application's screens where I adapt this kind of funccionality and the behaviour is exactly the same.
Can you please provide me some help here? My project deadline is some days from now, and I've only noticed this today :(
Thanks in advance,
Carlos Sampaio
Obviously, I have several objects that are related to another ones, and in order to get those objects "connected" and accessible from each other I've defined some persistence classes.
Example, I have the table DocumentosReuniao (MeetingDocuments) and EstadosDocumento (DocumentState):
PS: I've not posted the other fields in order to focus on a specific example:
[Table("DOCUMENTOS_REUNIAO")]
[KeyGenerator(KeyGenerator.Autoinc)]
public partial class DocumentosReuniao
{
private long _Id;
[Column("ID", OpenAccessType = OpenAccessType.Decimal, IsBackendCalculated = true, IsPrimaryKey = true, Length = 22, SqlType = "NUMBER")]
[Storage("_Id")]
public virtual long IdProp
{
get
{
return this._Id;
}
set
{
this._Id = value;
}
}
[...]
private long _Estadodocumentoid;
[Column("ESTADO_DOCUMENTO_ID", OpenAccessType = OpenAccessType.Decimal, Length = 22, SqlType = "NUMBER")]
[Storage("_Estadodocumentoid")]
public virtual long EstadoDocumentoIdProp
{
get
{
return this._Estadodocumentoid;
}
set
{
this._Estadodocumentoid = value;
}
}
private EstadosDocumento _Estadosdocumento;
[ForeignKeyAssociation(ConstraintName = "DR_ED_FK", SharedFields = "EstadoDocumentoIdProp", TargetFields = "IdProp")]
[Storage("_Estadosdocumento")]
public virtual EstadosDocumento EstadosdocumentoProp
{
get
{
return this._Estadosdocumento;
}
set
{
this._Estadosdocumento = value;
}
}
}
and
[Table("ESTADOS_DOCUMENTO")]
[KeyGenerator(KeyGenerator.Autoinc)]
public partial class EstadosDocumento
{
private long _Id;
[Column("ID", OpenAccessType = OpenAccessType.Decimal, IsBackendCalculated = true, IsPrimaryKey = true, Length = 22, SqlType = "NUMBER")]
[Storage("_Id")]
public virtual long IdProp
{
get
{
return this._Id;
}
set
{
this._Id = value;
}
}
[...]
private IList<DocumentosReuniao> _Documentosreuniaos = new List<DocumentosReuniao>();
[Collection(InverseProperty = "EstadosdocumentoProp")]
[Storage("_Documentosreuniaos")]
public virtual IList<DocumentosReuniao> DocumentosReuniaos
{
get
{
return this._Documentosreuniaos;
}
}
}
And the Persistence Metadata class:
[MetadataTypeAttribute(typeof(DocumentosReuniao.DocumentosReuniaoMetadata))]
public partial class DocumentosReuniao
{
internal sealed class DocumentosReuniaoMetadata
{
[Key]
public long IdProp { get; set; }
[...]
//ESTADOS_REUNIAO
[Association("EstadoDocumento_DocumentoReuniao", "EstadoDocumentoIdProp", "IdProp")]
[Include]
public EstadosDocumento EstadosdocumentoProp { get; set; }
}
}
What happends, is when I'm editing a DocumentoReuniao object through a silverlight radDataForm:
PS: Again, I've not posted all object attributes because they would only add confusion:
<telerik:RadDataForm x:Name="frmDocumentoReuniao" AutoGenerateFields="False"
CommandButtonsVisibility="{Binding Path=DataContext.UtilizadorOperadorAdministrador, Converter={StaticResource BooleanToCommandVisibility}, ElementName=LayoutRoot}"
ValidationSummaryVisibility="Collapsed"
ReadOnlyTemplate="{StaticResource LeituraDocumentoReuniao}" EditTemplate="{StaticResource EditarDocumentoReuniao}"
CurrentItem="{Binding Path=DataContext.DocumentoReuniaoSeleccionado,Mode=TwoWay,ElementName=LayoutRoot}"
Visibility="{Binding ExisteDocumentoReuniaoSeleccionado, Converter={StaticResource ConverteBooleanParaVisibilidade}}">
</telerik:RadDataForm>
and the fields that control the actual relation between the two objects:
ReadOnlyMode:
<TextBlock Text="Estado Doc.:"
FontWeight="Bold" FontSize="11" HorizontalAlignment="Left" VerticalAlignment="Center"
Grid.Column="2" Grid.Row="2" Margin="2,0"
telerik:StyleManager.Theme="{Binding Path=DataContext.Tema, ElementName=LayoutRoot}"/>
<TextBlock Text="{Binding EstadosdocumentoProp.DesignacaoProp}" MaxWidth="220"
Grid.Column="3" Grid.Row="2"
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,0"
telerik:StyleManager.Theme="{Binding Path=DataContext.Tema, ElementName=LayoutRoot}"/>
EditMode:
<TextBlock Text="Estado Doc.:"
FontWeight="Bold" FontSize="11" HorizontalAlignment="Left" VerticalAlignment="Center"
Grid.Column="2" Grid.Row="2" Margin="2,0"
telerik:StyleManager.Theme="{Binding Path=DataContext.Tema, ElementName=LayoutRoot}"/>
<telerik:RadComboBox x:Name="lstEmVotacao"
ItemsSource="{Binding Path=DataContext.OCEstadosDocumento, ElementName=LayoutRoot}"
SelectedItem="{Binding EstadosdocumentoProp, Mode=TwoWay}"
DisplayMemberPath="DesignacaoProp"
HorizontalAlignment="Left" VerticalAlignment="Center" Width="110" MaxWidth="130" Margin="2,0"
Grid.Column="3" Grid.Row="2"
Cursor="Hand">
</telerik:RadComboBox>
Ok, now, the application scenario can be seen in the attached files appscenario 0.png, appscenario 1.png , appscenario 2.png
I chose to edit the object, then change the EstadoDocumento Property in the radComboBox and then CANCEL the change I've made..
As you can see in the appscenario 3.png attached file, the binded value remains the last choice from the radComboBox... I've made the test with other attributes (non other object referenced ones) and got the changes I've made ignore like it should be...
I leave you the debug time values of the EditEnded event of the radDataForm with the attached files: formeditended.png , object state.png and objectstate in context.png .
I've checked my application's screens where I adapt this kind of funccionality and the behaviour is exactly the same.
Can you please provide me some help here? My project deadline is some days from now, and I've only noticed this today :(
Thanks in advance,
Carlos Sampaio