Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
 public SyncStrategyV1(EntitySyncingBaseV1 <T> entitySync)
 {
     _entitySync = entitySync;
 }