DataMember.Code scope

escjosh
edited February 2012 in Photon Server
For the Code member on the DataMember attribute:
[DataMember(Code = (byte)ParameterCode.InterestAreaId)]
public byte InterestAreaId { get; set; }

Does Code need to be globally unique (as it is in the ParameterCode enum), or does it work like a typical contract id as in protobuf etc?

In other words, is the following example OK or is it a problem for both A.Field and B.Field to have the same parameter code?
class A : DataContract
{
	[DataMember( Code = 0 )]
	public int Field { get; set; }
}

class B : DataContract
{
	[DataMember( Code = 0 )]
	public int Field { get; set; }
}

Comments

  • Sorry for the late reaction. I'll get a "server" colleague to answer that asap.
  • The code does not need to be globally unique. It only must be unique within the DataContract.
  • Parameter codes also don't have to be globally unique, but only unique per operation/event.