1
zrg
2024-11-19 c8ea1579594ac9f7adf519d8ec9ee868d8fec54f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Taobao.Top.Link.Endpoints
{
    /// <summary>simple id with Name
    /// </summary>
    public class SimpleIdentity : Identity
    {
        public string Name { get; private set; }
 
        public SimpleIdentity(string name)
        {
            this.Name = name;
        }
 
        public Identity Parse(object data)
        {
            return new SimpleIdentity((data as IDictionary<string, string>)["name"]);
        }
 
        public void Render(object to)
        {
            (to as IDictionary<string, object>).Add("name", this.Name);
        }
 
        public bool Equals(Identity id)
        {
            return this.Name.Equals((id as SimpleIdentity).Name);
        }
    }
}