Facing issues when calling the csla classes from silver light

Facing issues when calling the csla classes from silver light

Old forum URL: forums.lhotka.net/forums/t/9184.aspx


Santosh posted on Thursday, July 08, 2010


I am getting the below error when i am trying to call the public method of the CSLA class.

Error Details

 Type 'HIA.BM.BL.CSLAClasses.SpreadofResults+Criteria' with data contract name 'SpreadofResults.Criteria:http://schemas.datacontract.org/2004/07/HIA.BM.BL.CSLAClasses' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

I have a class SpreadofResults and  in this class i have declared another class Criteria .

I have declared Serializable Attribute on both the classes.

 


Can any one help me to solve this issue.

RockfordLhotka replied on Thursday, July 08, 2010

Objects must be marked as Serializable and must implement IMobileObject to be serialized by the CSLA .NET for Silverlight data portal. The easiest way to ensure your object implements IMobileObject is to inherit from a pre-existing CSLA base class (like CriteriaBase).

Santosh replied on Friday, July 09, 2010

Thanks Rocky

Now i am facing another problem, My criteria class values are not passed to the Dataportal Fetch Method.

Below is my criteria class and DataPortal Fetch Method.

 

 [Serializable]

public class Criteria :CriteriaBase<Criteria>
{

 public short TaxonomyId { get; set; }
 
public long EntityId { get; set; }
 
public long PeerGroupId { get; set; }
 
public string ReportType { get; set; }
 
public int Year { get; set; }
 
public string Ratio { get; set; }
 
public decimal LowerRatio { get; set; }
 
public decimal UpperRatio { get; set; }
 
public int[] filterIds { get; set; }
 
public bool hideAllOtherMembers { get; set; }
 
public bool ShowLocalMembers { get; set; }
 
public bool ShowCoreMembers { get; set; }
 
public string DatasetType { get; set; }
 
public string YearString { get; set; }
}


private void DataPortal_Fetch(Criteria criteria)

{

//here Criteria object values are coming as null."

}


Can you give some example for CSLA.Net with Silver Light.

RockfordLhotka replied on Friday, July 09, 2010

Santosh

Can you give some example for CSLA.Net with Silver Light.

Yes, there are a whole bunch of samples in the Samples download in the \CslaLight folder, including several that use criteria classes.

Copyright (c) Marimer LLC