Note that there are some explanatory texts on larger screens.

plurals
  1. POWays to keep abstract method server side for WCF
    text
    copied!<p>We are enforcing all our domain objects to implement GetHashCode.</p> <pre><code>namespace Core { [Serializable] public abstract class DomainObject { public abstract override int GetHashCode(); } } namespace Entity.Domain { [Serializable] [DataContract] public partial class IdCard : DomainObject { private System.Int32 _effDte; [DataMember] public virtual System.Int32 EffDte { get { return _effDte; } set { _effDte = value; } } public override int GetHashCode() { return EffDte.GetHashCode(); } } } </code></pre> <p>When we expose these domain objects through WCF, the following generated service is requiring a post-update modification to compile. </p> <pre><code>//------------------------------------------------------------------------------ // &lt;auto-generated&gt; // This code was generated by a tool. // Runtime Version:2.0.50727.3053 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // &lt;/auto-generated&gt; //------------------------------------------------------------------------------ namespace IdCardManagerServiceReference { using System.Runtime.Serialization; using System; [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Name="IdCard", Namespace="http://schemas.datacontract.org/2004/07/Entity.Domain")] [System.SerializableAttribute()] public partial class IdCard : Core.DomainObject, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { [System.NonSerializedAttribute()] private System.Runtime.Serialization.ExtensionDataObject extensionDataField; [System.Runtime.Serialization.OptionalFieldAttribute()] private int EffDteField; [global::System.ComponentModel.BrowsableAttribute(false)] public System.Runtime.Serialization.ExtensionDataObject ExtensionData { get { return this.extensionDataField; } set { this.extensionDataField = value; } } [System.Runtime.Serialization.DataMemberAttribute()] public int EffDte { get { return this.EffDteField; } set { if ((this.EffDteField.Equals(value) != true)) { this.EffDteField = value; this.RaisePropertyChanged("EffDte"); } } } } </code></pre> <p><strong>Any ideas on how to keep the requirement for GetHashCode, but remove the requirement for any code on the client (as an update or as partial classes)?</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload