FORUMS
Remove All Ads from XDA
Honor 7x
Win an Honor 7X!

WCF Inheritance and Phone 7

60 posts
Thanks Meter: 0
 
By bowpay, Member on 28th October 2010, 06:29 PM
Post Reply Email Thread
Hey guys wondering if someone could help me. I have a MVP framework that I use to help with SoC. The problem I am having is my MVP framework uses abstract base partial classes that implement the properties for a given object. I say its a problem because WCF does not like base classes therefor passes an empty object to the phone 7 app. Now I removed the partial abstract from the class and keep the inheritance however the object is still empty.

I also added KnownType attributes to the service and objects and updated the reference in the phone 7 app. KnownType does not work with a phone 7 project and it is easily repeatable.

This is driving me crazy because I have to use base classes because the framework is auto generated and therefor need a generated.cs class to back the main class.

Service

Code:
using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using BeeBQ.Core.Entity;
namespace WcfService1
{
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
publicclasstest
{
[OperationContract]
[ServiceKnownType(typeof(GrillBrandBase))]
publicvoid DoWork(GrillBrand brand)
{
// Add your operation implementation here
return;
}
// Add more operations here and mark them with [OperationContract]
}
}
object

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel;
using System.Collections;
using System.ServiceModel;
#region license
/*------------------------------------------------------------------------
<generated>
IT IS AGAINST THE LICENSE AGREEMENT TO REMOVE THIS LICENSE HEADER.
Developed By: Brian Coggin [bcoggin[at]bowpay.com]
Generated with: .netMVP Framework v1.1
Generated at 10/27/2010 6:53:33 PM.
The .netMVP Framework is based on the MVP pattern. .netMVP was developed 
to enforce SoC by introducing a layer between .netTiers[DAL] and HTML[View] 
there by allowing a developer or small team of developers to output projects 
in a fast paced enviornment while enforcing SoC[Seperation of Concerns] style development. 
The .netMVP framework is copyrighted and is not intended for resale.
This file will be overwritten when regenerating your code.
</generated>
------------------------------------------------------------------------*/
 
#endregion
///<remarks>
/// This file is generated once and will never be overwritten.
///</remarks> 

namespace BeeBQ.Core.Entity
{
[DataContract]
publicclassGrillBrand : GrillBrandBase
{ 
#region Constructors
///<summary>
/// Creates a new <see cref="GrillBrand"/> instance.
///</summary>
public GrillBrand():base() { }

#endregion
}
}
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel;
using System.ServiceModel;
#region license
/*------------------------------------------------------------------------
<generated>
IT IS AGAINST THE LICENSE AGREEMENT TO REMOVE THIS LICENSE HEADER.
Developed By: Brian Coggin [bcoggin[at]bowpay.com]
Generated with: .netMVP Framework v1.1
Generated at 10/27/2010 6:53:33 PM.
The .netMVP Framework is based on the MVP pattern. .netMVP was developed 
to enforce SoC by introducing a layer between .netTiers[DAL] and HTML[View] 
there by allowing a developer or small team of developers to output projects 
in a fast paced enviornment while enforcing SoC[Seperation of Concerns] style development. 
The .netMVP framework is copyrighted and is not intended for resale.
This file will be overwritten when regenerating your code.
</generated>
------------------------------------------------------------------------*/
 
#endregion
/*
File generated by .netMVP
Important: Do not modify this file. Edit the file GrillBrand.cs instead. This file will be overwritten
*/
namespace BeeBQ.Core.Entity
{
[DataContract]
[KnownType(typeof(GrillBrand))]
publicclassGrillBrandBase
{ 
#region Properties

[DataMember]
public System.Int32 Id { get; set; }
[DataMember]
public System.String Name { get; set; }
[DataMember]
public System.String CompanyUrl { get; set; }

#endregion
}
}
 
 
 
 
28th October 2010, 08:01 PM |#2  
bowpay's Avatar
OP Member
Thanks Meter: 0
 
More
Well fixed my own problem. Sort of anyways. After a ton of surfing I realized that windows phone 7 doesn't support inheritance when using WCF and I will have to wait for silverlight 4. In the meantime I made the abstract base class an interface and just implement the properties. The cool thing is it's still all auto generated so I will just have to manually implement the database changes if any.
29th October 2010, 07:43 PM |#3  
Senior Member
Thanks Meter: 2
 
More
yet another thing missing from Windows Phone 7
30th October 2010, 07:06 PM |#4  
bowpay's Avatar
OP Member
Thanks Meter: 0
 
More
Well actually the real problem with inheritance is more of the auto generation of the proxy classes. This can be resolved by not using the auto generated tools. This is also by design as SOA is flat and not OOP. Also I have had more problems with WCF, REST and endpoints than anything. I think I may just work on CodeSmith template that generates the service layer proxy for me -- Besides manually consuming a service is best practice anyways.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes