This question is locked. New answers and comments are not allowed.
Hi there,
I'm implementing a silverlight application on wich I use Telerik's ORM.
On my generated Context
public IQueryable<FormasContacto> GetFormasContactos()
{
return this.DataContext.FormasContactos;
}
public void DeleteFormasContactos(FormasContacto formasContacto)
{
// This is a callback method. The actual Delete is performed internally.
}
public void UpdateFormasContactos(FormasContacto formasContacto)
{
if (formasContacto != null)
{
bool i = this.DataContext.FormasContactos.Any(a =>
a.DesignacaoProp.ToUpper().Trim() == formasContacto.DesignacaoProp.ToUpper().Trim() &&
a.IdProp != formasContacto.IdProp);
}
}
public void InsertFormasContactos(FormasContacto formasContacto)
{
// This is a callback method. The actual Insert is performed internally.
}
If I intended to do some validations ("Server side") before inserting, updating or deleting a "FormasContacto" how should I proceed?
Note: in method "UpdateFormasContactos" I was checking if there was another "FormasContacto" entity with the same "DesignacaoProp"... and if I wanted to cancel the update action if the result of my "custom" validation is true or false?
Another question is, if I could cancel any insert, update or delete after doing some validations on the referred methos, how could I inform the silverlight application of what happened? Throw Exceptions?
Thanks in advance
Carlos Sampaio
I'm implementing a silverlight application on wich I use Telerik's ORM.
On my generated Context
public IQueryable<FormasContacto> GetFormasContactos()
{
return this.DataContext.FormasContactos;
}
public void DeleteFormasContactos(FormasContacto formasContacto)
{
// This is a callback method. The actual Delete is performed internally.
}
public void UpdateFormasContactos(FormasContacto formasContacto)
{
if (formasContacto != null)
{
bool i = this.DataContext.FormasContactos.Any(a =>
a.DesignacaoProp.ToUpper().Trim() == formasContacto.DesignacaoProp.ToUpper().Trim() &&
a.IdProp != formasContacto.IdProp);
}
}
public void InsertFormasContactos(FormasContacto formasContacto)
{
// This is a callback method. The actual Insert is performed internally.
}
If I intended to do some validations ("Server side") before inserting, updating or deleting a "FormasContacto" how should I proceed?
Note: in method "UpdateFormasContactos" I was checking if there was another "FormasContacto" entity with the same "DesignacaoProp"... and if I wanted to cancel the update action if the result of my "custom" validation is true or false?
Another question is, if I could cancel any insert, update or delete after doing some validations on the referred methos, how could I inform the silverlight application of what happened? Throw Exceptions?
Thanks in advance
Carlos Sampaio