本文整理汇总了C#中Couchbase.Configuration.Client.ClientConfiguration.Serializer方法的典型用法代码示例。如果您正苦于以下问题:C# ClientConfiguration.Serializer方法的具体用法?C# ClientConfiguration.Serializer怎么用?C# ClientConfiguration.Serializer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Couchbase.Configuration.Client.ClientConfiguration
的用法示例。
在下文中一共展示了ClientConfiguration.Serializer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTranscoder
/// <summary>
/// Gets a Func for creating <see cref="ITypeTranscoder"/> transcoders.
/// </summary>
/// <param name="config">The current <see cref="ClientConfiguration"/>.</param>
/// <param name="typeName">The name of the type implementing <see cref="ITypeTranscoder"/>.</param>
/// <returns>A <see cref="Func{ITypeTranscoder}"/> for creating <see cref="ITypeTranscoder"/>s.</returns>
public static Func<ITypeTranscoder> GetTranscoder(ClientConfiguration config, string typeName)
{
var parameters = new object[]
{
config.Converter(),
config.Serializer()
};
var type = Type.GetType(typeName, true);
return () => (ITypeTranscoder)Activator.CreateInstance(type, parameters);
}
示例2: When_Custom_Serializer_Configured_In_AppConfig_It_Is_Returned
public void When_Custom_Serializer_Configured_In_AppConfig_It_Is_Returned()
{
var section = (CouchbaseClientSection)ConfigurationManager.GetSection("couchbaseClients/couchbase_2");
var config = new ClientConfiguration(section);
Assert.IsInstanceOf<FakeSerializer>(config.Serializer());
}