Exception
An exception of type 'System.ServiceModel.CommunicationException' occurred in mscorlib.dll but was not handled in user code
Additional information: There was an error while trying to serialize parameter http
/<url>/:includeFields. The InnerException message was 'Type 'SD.LLBLGen.Pro.ORMSupportClasses.EntityField2' with data contract name 'EntityField2:[http://schemas.datacontract.org/2004/07/SD.LLBLGen.Pro.ORMSupportClasses](http://schemas.datacontract.org/2004/07/SD.LLBLGen.Pro.ORMSupportClasses)' 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.'. Please see InnerException for more details.
Code:
code in service Interface
[ServiceKnownType(typeof(IEntityCollection2))]
[ServiceKnownType(typeof(ExcludeIncludeFieldsList))]
[OperationContract]
IEntityCollection2 getFac(string facId, ExcludeIncludeFieldsList includeFields);
Code in service
public IEntityCollection2 getFac(string facId, ExcludeIncludeFieldsList includeFields)
{
EntityCollection results = new EntityCollection(new FacVwEntityFactory());
RelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.PredicateExpression.Add(FacVwFields.Status == "ACTIVE");
bucket.PredicateExpression.Add(FacVwFields.FacId == facId);
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.FetchEntityCollection(results,includeFields, bucket);
}
return results;
}
code in .aspx
protected void bindFac(string facId)
{
ChannelFactory<IFacService> facFactory = new ChannelFactory<IFacService>("facService");
IFacService facServer = facFactory.CreateChannel();
using (facServer as IDisposable)
{
ExcludeIncludeFieldsList includeFields = new ExcludeIncludeFieldsList();
includeFields.ExcludeContainedFields = false;
includeFields.Add(FacVwFields.MessageId);
includeFields.Add(FacVwFields.Message);
EntityCollection facCollection = (EntityCollection)facServer .getFac(facID, includeFields);
RadGrid facGrid = (RadGrid)RadPanelBar1.FindItemByValue("PanelItem1").FindControl("RadGridFac");
facGrid .DataSource = facCollection ;
facGrid .DataBind();
}
}
I start getting error when I try to pass the ExcludeIncludeFieldsList as the parameter.
I am using the 2.6 Final version of LLBLGen Pro.
Please let me know if you need any further information.
thanks
Sam