public async void GetAll(string className, string sql, Action <IEnumerable <T> > completed) { Debug.WriteLine("DataGetter instantiated"); string task = await dataGetter.GetAll(className, sql); if (task != "") { IEnumerable <T> newList = BoytrixSerializer.DeserializeParams <T>(task); var container = ServiceLocator.Current.GetInstance <IUnityContainer>(); container.RegisterInstance(className, newList, new ContainerControlledLifetimeManager()); completed(null); } }
public async void Find(string className, string sql, Action <IEnumerable <T> > completed) { Debug.WriteLine("DataGetter instantiated"); string task = await dataGetter.Find(className, sql); if (task != "") { IEnumerable <T> newList = BoytrixSerializer.DeserializeParams <T>(task); completed(newList); } else { completed(null); } }
public async void GetWithSp(string sql, string className, Action <bool, string> completed) { Debug.WriteLine("XmlDataStore instantiated"); string taskXml = await dataGetter.GetWtihSp(sql); //if (!XmlDataStore.ContainsKey(className)) //{ // XmlDataStore.Add(className, taskXml); //} //else //{ // XmlDataStore.Remove(className); // XmlDataStore.Add(className, taskXml); //} var container = ServiceLocator.Current.GetInstance <IUnityContainer>(); container.RegisterInstance(className, taskXml, new ContainerControlledLifetimeManager()); if (taskXml != "") { IEnumerable <T> newList = BoytrixSerializer.DeserializeParams <T>(className, taskXml); if (newList != null) { var reg = container.Registrations.FirstOrDefault(r => r.Name == className && r.RegisteredType == typeof(IEnumerable <T>)); if (reg != null) { reg.LifetimeManager.RemoveValue(); } container.RegisterInstance(className, newList, new ContainerControlledLifetimeManager()); } } completed(true, taskXml); }
public void GetDataFromXml(string sql, string className, Action <bool> completed) { var container = ServiceLocator.Current.GetInstance <IUnityContainer>(); var xml = container.Resolve <string>(className); IEnumerable <T> newList = BoytrixSerializer.DeserializeParams <T>(className, xml); if (newList != null) { var reg = container.Registrations.FirstOrDefault(r => r.Name == sql && r.RegisteredType == typeof(IEnumerable <T>)); if (reg != null) { reg.LifetimeManager.RemoveValue(); } container.RegisterInstance(className, newList, new ContainerControlledLifetimeManager()); } completed(true); }