Example #1
0
        void IInterceptableType.SetValues(string detailCollectionName, System.Collections.IEnumerable values)
        {
            if (values == null)
            {
                if (DetailCollections.ContainsKey(detailCollectionName))
                {
                    DetailCollections.Remove(detailCollectionName);
                }
                return;
            }
            var collection = GetDetailCollection(detailCollectionName, true);

            collection.Replace(values);
        }
Example #2
0
 /// <summary>Gets a named detail collection.</summary>
 /// <param name="collectionName">The name of the detail collection to get.</param>
 /// <param name="createWhenEmpty">Wether a new collection should be created if none exists. Setting this to false means null will be returned if no collection exists.</param>
 /// <returns>A new or existing detail collection or null if the createWhenEmpty parameter is false and no collection with the given name exists..</returns>
 public virtual Details.DetailCollection GetDetailCollection(string collectionName, bool createWhenEmpty)
 {
     if (DetailCollections.ContainsKey(collectionName))
     {
         return(DetailCollections[collectionName]);
     }
     else if (createWhenEmpty)
     {
         Details.DetailCollection collection = new Details.DetailCollection(this, collectionName);
         DetailCollections.Add(collectionName, collection);
         return(collection);
     }
     else
     {
         return(null);
     }
 }
Example #3
0
 public string Translate(string key, string fallback = null)
 {
     return(DetailCollections.GetTranslation(key) ?? fallback);
 }
Example #4
0
 public IDictionary <string, string> GetTranslations()
 {
     return(DetailCollections.GetTranslations());
 }