Пример #1
0
        public void Sync_Test()
        {
            using (var context = new AcManContext(OptionsRandom)) { //MsSql2016Options
                var userId                     = TestDemoData.CreateTestData(context);
                var bpm                        = DemoTS_ODBase;     //MsSqlMKODBase
                var userRepository             = new UserRepository(context);
                var activityRepository         = new ActivityRepository(context);
                var synchronizationRepository  = new SynchronizationRepository(context);
                var bpmOdataConverter          = new BpmOdataConverter();
                var activityBpmOdataRepository = new ActivityBpmOdataRepository(bpm, bpmOdataConverter);

                var bpmonlineSyncStrategy = new BpmonlineSyncStrategy(
                    userRepository,
                    activityRepository,
                    synchronizationRepository,
                    activityBpmOdataRepository
                    );
                var startCount     = activityRepository.GetAll().Count;
                var remoteActivity = new Activity {
                    UserId  = userId,
                    Caption = "[Acman] Test remote activity " + AcmanHelper.GetCurrentDateTime().ToString()
                };
                remoteActivity.EndSystemRecordId = activityBpmOdataRepository.Add(remoteActivity);
                bpmonlineSyncStrategy.Sync();
                var endCount = activityRepository.GetAll().Count;
                Assert.IsTrue(endCount > startCount);
                activityBpmOdataRepository.Remove(remoteActivity);
            }
        }
Пример #2
0
        public BaseBpmOdataRepository(ODBase context, BpmOdataConverter bpmOdataConverter)
        {
            var remoteEntityNameAttribute = typeof(T).GetTypeInfo().GetCustomAttribute <RemoteEntityName>();

            if (remoteEntityNameAttribute == null)
            {
                throw new Exception("Attribute [RemoteEntityName] not found in class <" + typeof(T).Name + ">.");
            }
            _collectionName    = remoteEntityNameAttribute.Name;
            _context           = context;
            _bpmOdataConverter = bpmOdataConverter;
        }
 public ActivityBpmOdataRepository(ODBase context, BpmOdataConverter bpmOdataConverter) : base(context, bpmOdataConverter)
 {
 }