/// <summary> /// Adds entity 4 sync of StrategyV1 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="table"></param> /// <param name="entity"></param> public void AddEntity4Sync <T>(EntitySyncingBaseV1 <T> entity) { if (lstToSync.ContainsKey(typeof(T).ToString())) { return; } entity.SyncingEngine = this; EntityFold <T> igo = new EntityFold <T>() { type = typeof(T), entity = entity, }; //Here SyncStrategyV1 will be used Type openGenericClass = typeof(SyncStrategyV1 <>); Type dynamicClosedGenericClass = openGenericClass.MakeGenericType(igo.type); igo.Instance = Activator.CreateInstance(dynamicClosedGenericClass, entity); igo.SyncEntity = dynamicClosedGenericClass.GetMethod("SyncEntity"); var pi = dynamicClosedGenericClass.GetProperty("SyncEngine"); pi.SetValue(igo.Instance, this); lstToSync.Add(igo.type.ToString(), igo); }
public SyncStrategyV1(EntitySyncingBaseV1 <T> entitySync) { _entitySync = entitySync; }