Out with MagicOnion, in with LiteNetLib
Removed MagicOnion Added LiteNetLib Created client and server abstractions Fixed serialization bugs
This commit is contained in:
parent
433a7b4ae4
commit
e96146b7bb
869 changed files with 59401 additions and 16812 deletions
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using RethinkDb.Driver.Net;
|
||||
|
||||
namespace RethinkDb.Driver.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// A grouped result helper.
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">The KEY type</typeparam>
|
||||
/// <typeparam name="TElement">The VALUE type</typeparam>
|
||||
public class GroupedResult<TKey, TElement> : IGrouping<TKey, TElement>
|
||||
{
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
public GroupedResult(JToken key, JArray items)
|
||||
{
|
||||
this.Key = key.ToObject<TKey>(Converter.Serializer);
|
||||
this.Items = items.ToObject<List<TElement>>(Converter.Serializer);
|
||||
}
|
||||
public GroupedResult(JToken key, JValue item)
|
||||
{
|
||||
this.Key = key.ToObject<TKey>(Converter.Serializer);
|
||||
var value = item.ToObject<TElement>(Converter.Serializer);
|
||||
this.Items = new List<TElement>() {value};
|
||||
}
|
||||
|
||||
public IEnumerator<TElement> GetEnumerator()
|
||||
{
|
||||
return this.Items.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
#pragma warning restore 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
/// <summary>
|
||||
/// The Key
|
||||
/// </summary>
|
||||
public TKey Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The list of items grouped by <see cref="Key"/>
|
||||
/// </summary>
|
||||
public List<TElement> Items { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A typed grouped result helper.
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">The KEY type</typeparam>
|
||||
/// <typeparam name="TItem">The VALUE type</typeparam>
|
||||
public class GroupedResultSet<TKey, TItem> : List<GroupedResult<TKey, TItem>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Item type
|
||||
/// </summary>
|
||||
public Type ItemType => typeof(TItem);
|
||||
|
||||
/// <summary>
|
||||
/// Key type
|
||||
/// </summary>
|
||||
public Type KeyType => typeof(TKey);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue