//-----------------------------------------------------------------------
//
// Copyright (c) Andrew Arnott. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
///
/// A protocol message that supports adding extensions to the payload for transmission.
///
[ContractClass(typeof(IProtocolMessageWithExtensionsContract))]
public interface IProtocolMessageWithExtensions : IProtocolMessage {
///
/// Gets the list of extensions that are included with this message.
///
///
/// Implementations of this interface should ensure that this property never returns null.
///
IList Extensions { get; }
}
///
/// Code contract for the interface.
///
[ContractClassFor(typeof(IProtocolMessageWithExtensions))]
internal abstract class IProtocolMessageWithExtensionsContract : IProtocolMessageWithExtensions {
///
/// Prevents a default instance of the class from being created.
///
private IProtocolMessageWithExtensionsContract() {
}
#region IProtocolMessageWithExtensions Members
///
/// Gets the list of extensions that are included with this message.
///
///
/// Implementations of this interface should ensure that this property never returns null.
///
IList IProtocolMessageWithExtensions.Extensions {
get {
Contract.Ensures(Contract.Result>() != null);
throw new NotImplementedException();
}
}
#endregion
#region IProtocolMessage Members
///
/// Gets the level of protection this message requires.
///
MessageProtections IProtocolMessage.RequiredProtection {
get { throw new NotImplementedException(); }
}
///
/// Gets a value indicating whether this is a direct or indirect message.
///
MessageTransport IProtocolMessage.Transport {
get { throw new NotImplementedException(); }
}
#endregion
#region IMessage Members
///
/// Gets the version of the protocol or extension this message is prepared to implement.
///
///
/// Implementations of this interface should ensure that this property never returns null.
///
Version IMessage.Version {
get {
throw new NotImplementedException();
}
}
///
/// Gets the extra, non-standard Protocol parameters included in the message.
///
///
/// Implementations of this interface should ensure that this property never returns null.
///
IDictionary IMessage.ExtraData {
get {
throw new NotImplementedException();
}
}
///
/// Checks the message state for conformity to the protocol specification
/// and throws an exception if the message is invalid.
///
///
/// Some messages have required fields, or combinations of fields that must relate to each other
/// in specialized ways. After deserializing a message, this method checks the state of the
/// message to see if it conforms to the protocol.
/// Note that this property should not check signatures or perform any state checks
/// outside this scope of this particular message.
///
/// Thrown if the message is invalid.
void IMessage.EnsureValidMessage() {
throw new NotImplementedException();
}
#endregion
}
}