I am developing a SL application and need to pass a List<short> to the factory method and return a List<double>. How would I go about doing this?
Currently, I get an error:
Type 'System.Collections.Generic.List`1[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' with data contract name 'ArrayOfdouble:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Consider using a DataContractResolver or 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 know how I would go about this if I was using my own WCF service, but am not sure how to do it using the Csla.Server.Hosts.Silverlight.WcfPortal.
Tks.
This has been discussed a few times.
Thanks for the response, Rocky.
I got this to work for my return list of doubles, but can't seem to get it to work for my criteria class where I need to pass in a list of short values. I get the same error when attempting to pass a MobileList<Int16> within the criteria class. Should this work in that case too?
Tks
Does anyone have any thoughts or ideas as to why this is not working?
Tks much!
The property in your criteria class needs to be a managed property for CSLA to automatically treat it like a child object. Is your property a managed property?
Here is how my property looks in my critieria class:
public MobileList<Int16> VariableIds
{
get { return GetValue<MobileList<Int16>>("VariableIds"); }
set { _bag["VariableIds"] = value; }
}
The error I get is:
Type 'Csla.Core.MobileList`1[[System.Int16, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' with data contract name 'ArrayOfshort:http://schemas.microsoft.com/2003/10/Serialization/Arrays' 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.
Your criteria property should look like this:
public static PropertyInfo<MobileList<Int16>> VariableIdsProperty = RegisterProperty<MobileList<Int16>>(c => c.VariableIds);
public MobileList<Int16> VariableIds
{
get { return GetProperty(VariableIdsProperty ); }
private set { LoadProperty(VariableIdsProperty , value); }
}
Your property read the managed property value and set a totally different property in _bag.
Ok. I tried this but it seems that 'GetProperty(...)' is not a method within the 'CriteriaBase' class. I can't seem to find it.
Which version of Csla are you using?
v4.0.30319
There should be ReadProperty and LoadProperty methods. There wouldn't be GetProperty or SetProperty, because CriteriaBase has no support for business or authorization rules.
Yep, that did it.
Rocky and JonnyBee, thanks so much for your help!
Copyright (c) Marimer LLC