Пример #1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="JsonBuild" /> class.
 /// </summary>
 /// <param name="token">The token.</param>
 private JsonBuild(JToken token) : base(token)
 {
     r_DefinitionProvider = new Lazy <JsonBuildDefinition>(() =>
     {
         var src        = sr_Definition.Eval(this);
         var definition = JsonBuildDefinition.FromToken(src);
         return(definition);
     });
     r_DropProvider = new Lazy <JsonBuildDrop>(() =>
     {
         var src  = sr_Drop.Eval(this);
         var drop = JsonBuildDrop.FromToken(src);
         return(drop);
     });
     r_QueueProvider = new Lazy <JsonBuildQueue>(() =>
     {
         var src   = sr_Queue.Eval(this);
         var queue = JsonBuildQueue.FromToken(src);
         return(queue);
     });
     r_LastChangedByProvider = new Lazy <JsonIdentity>(() =>
     {
         var src      = sr_LastChangedBy.Eval(this);
         var identity = JsonIdentity.FromToken(src);
         return(identity);
     });
 }
Пример #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="JsonBackedObjectBase" /> class.
 /// </summary>
 /// <param name="json">The json.</param>
 public JsonBuildRequest(JToken json) : base(json)
 {
     r_BuildsProvider = new Lazy <IReadOnlyList <JsonBuild> >(() =>
     {
         var array = sr_Builds.Eval(this);
         List <JsonBuild> items = JsonParsers.JArrayToObjects(array, JsonBuild.FromToken);
         return(items);
     });
     r_DefinitionProvider = new Lazy <JsonBuildDefinition>(() =>
     {
         var src        = sr_Definition.Eval(this);
         var definition = JsonBuildDefinition.FromToken(src);
         return(definition);
     });
     r_QueueProvider = new Lazy <JsonBuildQueue>(() =>
     {
         var src   = sr_Queue.Eval(this);
         var queue = JsonBuildQueue.FromToken(src);
         return(queue);
     });
     r_RequesteddByProvider = new Lazy <JsonIdentity>(() =>
     {
         var src      = sr_RequestedBy.Eval(this);
         var identity = JsonIdentity.FromToken(src);
         return(identity);
     });
     r_RequesteddForProvider = new Lazy <JsonIdentity>(() =>
     {
         var src      = sr_RequestedFor.Eval(this);
         var identity = JsonIdentity.FromToken(src);
         return(identity);
     });
 }
Пример #3
0
        /// <summary>
        /// Froms the token.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns>JsonBuildDefinition.</returns>
        public static JsonBuildDefinition FromToken(JToken token)
        {
            var instance = new JsonBuildDefinition(token);

            return(instance);
        }