I’m creating an app based on SOA, I’ve created WCF Service Project using Framework 4.0, in that I’m using Entity framework, in WCF operation Contract method I’m using the class generated by the EF, but the WCF can’t recognize these objects, when I checked those classes in designer mode, they are like
[EdmEntityTypeAttribute(NamespaceName="quizTestDBModel", Name="tbl_adminUser")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
public partial class tbl_adminUser : EntityObject
{
#region Factory Method
/// <summary>
/// Create a new tbl_adminUser object.
/// </summary>
/// <param name="adminUserId">Initial value of the adminUserId property.</param>
public static tbl_adminUser Createtbl_adminUser(global::System.Int32 adminUserId, global::System.String name, global::System.String userid, global::System.String password)
{
tbl_adminUser tbl_adminUser = new tbl_adminUser();
tbl_adminUser.adminUserId = adminUserId;
return tbl_adminUser;
}
#endregion
#region Primitive Properties
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[DataMemberAttribute()]
public global::System.Int32 adminUserId
{
get
{
return _adminUserId;
}
set
{
if (_adminUserId != value)
{
OnadminUserIdChanging(value);
ReportPropertyChanging("adminUserId");
_adminUserId = StructuralObject.SetValidValue(value);
ReportPropertyChanged("adminUserId");
OnadminUserIdChanged();
}
}
}
private global::System.Int32 _adminUserId;
partial void OnadminUserIdChanging(global::System.Int32 value);
partial void OnadminUserIdChanged();
#endregion
}
When I use this class in my operation contract as
int adminRegister(tbl_adminUser _adminUser);
It give error on that method, “The operation is not supported in WCF Test Client, because it uses type tbl_adminUser”
Thanks
If you are passing platform-specific data across a service boundary, then you are not using SOA.
Entity Framework classes are specific to .NET and to Entity Framework. Do not pass them across a service boundary.
I also note that you want to subject your clients to your naming conventions (
tbl_adminUser), as well as the fact that there are tables involved. Why do the callers of your service need to know anything about the fact that you’ve implemented the concept of an “admin user” by using a table namedtbl_adminUser?You should create yourself a Data Transfer Object class named, for instance,
AdminUser. It should have properties for all of the interesting public aspects of an admin user (apparently, justAdminUserId). It should have no behavior at all – just data.This is the class that should be sent by and received from your service.
And, yes, you’ll have to implement mapping code.