using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.DAL.Observables
{
internal static class LoadedObjectsService
{
private static List<KeyValuePair<String, IObservableEntity>> LoadedObjects;
public static Object Get(String guid)
{
return LoadedObjects.SingleOrDefault(x => x.Key == guid).Value;
}
public static void Add(String guid, IObservableEntity observable)
{
if (!LoadedObjects.Exists(x => x.Key == guid))
{
LoadedObjects.Add(new KeyValuePair<string, IObservableEntity>(guid, observable));
}
}
public static bool Exists(String guid)
{
return LoadedObjects.Exists(x => x.Key == guid);
}
public static void Reset()
{
LoadedObjects.Clear();
}
static LoadedObjectsService()
{
LoadedObjects = new List<KeyValuePair<String, IObservableEntity>>();
}
}
}