当前位置: 首页>>代码示例>>C#>>正文


C# ISerializer.ToJson方法代码示例

本文整理汇总了C#中ISerializer.ToJson方法的典型用法代码示例。如果您正苦于以下问题:C# ISerializer.ToJson方法的具体用法?C# ISerializer.ToJson怎么用?C# ISerializer.ToJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISerializer的用法示例。


在下文中一共展示了ISerializer.ToJson方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TrackedEntity

 public TrackedEntity(object id, ISerializer serializer, Type documentType, object document)
 {
     _serializer = serializer;
     Id = id;
     DocumentType = documentType;
     Document = document;
     _json = _serializer.ToJson(document);
 }
开发者ID:kiliman,项目名称:marten,代码行数:8,代码来源:TrackedEntity.cs

示例2: QueryFromICollectionContains

 static IWhereFragment QueryFromICollectionContains(MethodCallExpression expression, string fieldPath, ISerializer serializer)
 {
     var constant = expression.Arguments[0] as ConstantExpression;
     var kvp = constant.Value; // is kvp<string, unknown>
     var kvpType = kvp.GetType();
     var key = kvpType.GetProperty("Key").GetValue(kvp);
     var value = kvpType.GetProperty("Value").GetValue(kvp);
     var dictType = typeof(Dictionary<,>).MakeGenericType(kvpType.GenericTypeArguments[0], kvpType.GenericTypeArguments[1]);
     var dict = dictType.GetConstructors()[0].Invoke(null);
     dictType.GetMethod("Add").Invoke(dict, new[] { key, value });
     var json = serializer.ToJson(dict);
     return new CustomizableWhereFragment($"{fieldPath} @> ?", "?", Tuple.Create<object, NpgsqlTypes.NpgsqlDbType?>(json, NpgsqlTypes.NpgsqlDbType.Jsonb));
 }
开发者ID:danielmarbach,项目名称:marten,代码行数:13,代码来源:DictionaryExpressions.cs

示例3: TrackedEntity

        public TrackedEntity(object id, ISerializer serializer, Type documentType, object document, string json)
        {
            _serializer = serializer;
            Id = id;
            DocumentType = documentType;
            Document = document;

            if (json != null && document == null)
            {
                Document = _serializer.FromJson(documentType, json);
            }
            else if (document != null)
            { 
                _json = _serializer.ToJson(document);
            }
        }
开发者ID:Xamarui,项目名称:marten,代码行数:16,代码来源:TrackedEntity.cs

示例4: EventParameters

 public EventParameters(ISerializer serializer, IEventMigrationHierarchyManager eventMigrationHierarchyManager)
 {
     _serializer = serializer;
     _eventMigrationHierarchyManager = eventMigrationHierarchyManager;
     _eventProperties = typeof(IEvent).GetProperties(BindingFlags.Public | BindingFlags.Instance);
     Parameters = new[]
                      {
                          new EventParameter(COMMANDCONTEXT,OracleDbType.Raw,16),
                          new EventParameter(NAME,OracleDbType.NVarchar2,512),
                          new MetaDataEventParameter(LOGICALNAME, OracleDbType.NVarchar2, 512, m => m.LogicalName),
                          new EventParameter(EVENTSOURCEID,OracleDbType.Raw,16),
                          new EventParameter(EVENTSOURCE,OracleDbType.NVarchar2,512),
                          new MetaDataEventParameter(GENERATION, OracleDbType.Int32, m => m.Generation),
                          new DataEventParameter(GetDataProperties, d => _serializer.ToJson(d,null)),
                          new EventParameter(CAUSEDBY,OracleDbType.NVarchar2,512),
                          new EventParameter(ORIGIN,OracleDbType.NVarchar2,512),
                          new EventParameter(OCCURED,OracleDbType.Date),
                          new EventParameter(VERSION,OracleDbType.Double),
                          new IdEventParameter()
                      };
 }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:21,代码来源:EventParameters.cs


注:本文中的ISerializer.ToJson方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。