I create a class MyClass,and driver from a interface IMyInterface,and MyClass has an Enum property, like bellow:
public Enum MyEnum
{
One=1,
Two=2
}
public class MyClass : IMyInterface
{
public MyClass() { }
public MyEnum EnumProperty {get; set;}
/*
Implement IMyInterface
*/
}
I use MyClass as a parameter of a Fetch method,like this
public static void Fetch(MyClass para,EventHandler<DataPortalResult<MyBusinessObject>> callback)
{
return DataPortal.BeginFetch<MyBusinessObject>(para,callback);
}
But this no work, It raise an error:MyClass is not a KnownType.
But the wcf service file is in csla project,where I can use the KnowTypeAttribute to register MyClass?
I use [Serializable()] attribute in MyClass,it still no work.
MyClass must either :
a) implement IMobileObject
b) inherit from MobileObject or any other existing class in Csla implementing IMobileObject. For instance, CriteriaBase seems a wise choice if your parameter is in fact a criteria...
and remember, each property in MyClass must use a managed backing field or you must override OnGetState/OnSetState/OnGetChildren/OnSetChildren and serialize each property manually... which is pretty painful code to write!
Finally, your enum properties should be declared as int and casted as your enum type. Here's a sample :
public static PropertyInfo<int> ProjectStatusProperty = RegisterProperty<int>(o => o.ProjectStatus, ProjectResources.ProjectStatus); public ProjectStatus ProjectStatus { get { return ( ProjectStatus) GetProperty(ProjectStatusProperty); } set { SetProperty(ProjectStatusProperty,(int) value); } }
Copyright (c) Marimer LLC