Browse Source

add summary comments.

master
Savorboard 7 years ago
parent
commit
59025d2113
4 changed files with 60 additions and 6 deletions
  1. +43
    -4
      src/DotNetCore.CAP/Abstractions/IContentSerializer.cs
  2. +8
    -0
      src/DotNetCore.CAP/Abstractions/IModelBinderFactory.cs
  3. +7
    -0
      src/DotNetCore.CAP/Abstractions/ISubscriberExecutor.cs
  4. +2
    -2
      src/DotNetCore.CAP/Abstractions/TopicAttribute.cs

+ 43
- 4
src/DotNetCore.CAP/Abstractions/IContentSerializer.cs View File

@@ -3,19 +3,58 @@ using DotNetCore.CAP.Models;

namespace DotNetCore.CAP.Abstractions
{
/// <summary>
/// Message content serializer.
/// <para>By default, CAP will use Json as a serializer, and you can customize this interface to achieve serialization of other methods.</para>
/// </summary>
public interface IContentSerializer
{
string Serialize<T>(T obj);
/// <summary>
/// Serializes the specified object to a string.
/// </summary>
/// <typeparam name="T"> The type of the value being serialized.</typeparam>
/// <param name="value">The object to serialize.</param>
/// <returns>A string representation of the object.</returns>
string Serialize<T>(T value);

T DeSerialize<T>(string content);
/// <summary>
/// Deserializes the string to the specified .NET type.
/// </summary>
/// <typeparam name="T">The type of the object to deserialize to.</typeparam>
/// <param name="value">The content string to deserialize.</param>
/// <returns>The deserialized object from the string.</returns>
T DeSerialize<T>(string value);

object DeSerialize(string content, Type type);
/// <summary>
/// Deserializes the string to the specified .NET type.
/// </summary>
/// <param name="value">The string to deserialize.</param>
/// <param name="type">The type of the object to deserialize to.</param>
/// <returns>The deserialized object from the string.</returns>
object DeSerialize(string value, Type type);
}

/// <summary>
/// CAP message content wapper.
/// <para>You can customize the message body filed name of the wrapper or add fields that you interested.</para>
/// </summary>
/// <remarks>
/// We use the wrapper to provide some additional information for the message content,which is important for CAP。
/// Typically, we may need to customize the field display name of the message,
/// which includes interacting with other message components, which can be adapted in this manner
/// </remarks>
public interface IMessagePacker
{
/// <summary>
/// Package a message object
/// </summary>
/// <param name="obj">The obj message to be packed.</param>
string Pack(CapMessage obj);

/// <summary>
/// Unpack a message strings to <see cref="CapMessage"/> object.
/// </summary>
/// <param name="packingMessage">The string of packed message.</param>
CapMessage UnPack(string packingMessage);
}
}
}

+ 8
- 0
src/DotNetCore.CAP/Abstractions/IModelBinderFactory.cs View File

@@ -3,8 +3,16 @@ using DotNetCore.CAP.Abstractions.ModelBinding;

namespace DotNetCore.CAP.Abstractions
{
/// <summary>
/// Model binder factory.
/// </summary>
public interface IModelBinderFactory
{
/// <summary>
/// Create a model binder by parameter.
/// </summary>
/// <param name="parameter">The method parameter info</param>
/// <returns>A model binder instance.</returns>
IModelBinder CreateBinder(ParameterInfo parameter);
}
}

+ 7
- 0
src/DotNetCore.CAP/Abstractions/ISubscriberExecutor.cs View File

@@ -3,8 +3,15 @@ using DotNetCore.CAP.Models;

namespace DotNetCore.CAP.Abstractions
{
/// <summary>
/// Consumer method executor.
/// </summary>
public interface ISubscriberExecutor
{
/// <summary>
/// Execute the consumer method.
/// </summary>
/// <param name="receivedMessage">The received message.</param>
Task<OperateResult> ExecuteAsync(CapReceivedMessage receivedMessage);
}
}

+ 2
- 2
src/DotNetCore.CAP/Abstractions/TopicAttribute.cs View File

@@ -4,7 +4,7 @@ namespace DotNetCore.CAP.Abstractions
{
/// <inheritdoc />
/// <summary>
/// An abstract attribute that for kafka attribute or rabbit mq attribute
/// An abstract attribute that for kafka attribute or rabbit mq attribute
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
public abstract class TopicAttribute : Attribute
@@ -15,7 +15,7 @@ namespace DotNetCore.CAP.Abstractions
}

/// <summary>
/// topic or exchange route key name.
/// Topic or exchange route key name.
/// </summary>
public string Name { get; }



Loading…
Cancel
Save