public Contents(IFormatReaders <System.Xml.XmlReader> factory, IClassification classification,
                 ITypedTable <IEnumerable <Action <XElement> > > migrations, IContents contents)
 {
     _factory        = factory;
     _classification = classification;
     _migrations     = migrations;
     _contents       = contents;
 }
Esempio n. 2
0
 public RegisteredCompositionExtension(ITypedTable <ISerializerComposer> composers) => _composers = composers;
Esempio n. 3
0
 internal void Add(ITypedTable table)
 {
     this.tables.Add(table);
 }
 public TypeProperty(ITypedTable <T> table, TypeInfo type) : base(table, type)
 {
 }
 public SerializationInterceptionExtension(ITypedTable <ISerializationInterceptor> registrations)
 => _registrations = registrations;
Esempio n. 6
0
 public RegisteredContents(IActivators activators, ICustomSerializers serializers)
 {
     _activators  = activators;
     _serializers = serializers;
 }
 public RegisteredCompositionExtension(ITypedTable <ISerializerComposer> table,
                                       ISerializerComposerResults composers)
 {
     _table     = table;
     _composers = composers;
 }
 public void Execute(ITypedTable <ISerializerComposer> parameter)
 {
     _store[0] = parameter;
 }
 public Contents(IContents contents, ITypedTable <ISerializerComposer> table)
 {
     _contents = contents;
     _table    = table;
 }
Esempio n. 10
0
        public Tracker(ITypedTable <TRecord> table, double autoSaveTimeMilliseconds)
        {
            this.table = table;

            this.UpdatedSubject = new Subject <DatabaseUpdatedEventArgs>().AddTo(this.Disposables);
            this.updateSubject  = new Subject <PropertyChangedContainer <TRecord> >().AddTo(this.Disposables);

            this.AutoSaveTimeMilliseconds = autoSaveTimeMilliseconds;

            var update = this.updateSubject
                         .Where(x => this.IsAutoSaving && this.table.TargetProperties.ContainsKey(x.PropertyName))
                         .Publish().RefCount();

            update
            .Buffer(update.Throttle(TimeSpan.FromMilliseconds(this.AutoSaveTimeMilliseconds)))
            .Where(x => x.Count > 0)
            .Subscribe(updatedItems =>
            {
                Task.Run(async() =>
                {
                    var succeeded = false;
                    using (var connection = await this.table.Parent.ConnectAsync())
                    {
                        using (var transaction = connection.BeginTransaction())
                        {
                            try
                            {
                                foreach (var item in updatedItems.GroupBy(x => x.Source))
                                {
                                    var properties = item.Select(x => x.PropertyName).Distinct().ToArray();
                                    await this.table.UpdateAsync
                                        (item.Key, connection, transaction,
                                        item.Select(x => x.PropertyName).ToArray())
                                    .ConfigureAwait(false);

                                    Debug.WriteLine(item.Key.Id.ToString() + " update " + properties.Join(","));
                                }

                                transaction.Commit();
                                succeeded = true;
                            }
                            catch (Exception e)
                            {
                                transaction.Rollback();
                                Debug.WriteLine(e.ToString());
                            }
                        }
                    }

                    if (succeeded)
                    {
                        this.UpdatedSubject.OnNext(new DatabaseUpdatedEventArgs()
                        {
                            Sender = this,
                            Action = DatabaseAction.Update,
                        });
                    }
                });
            })
            .AddTo(this.Disposables);
        }
Esempio n. 11
0
 public Tracker(ITypedTable <TRecord> table) : this(table, autoSaveTimeMillisecondsDefault)
 {
 }
Esempio n. 12
0
 public TableQueryable(IDbConnection connection, ITypedTable table)
 {
     this.connection = connection;
     this.Table      = table;
     this.orders     = new List <string>();
 }
Esempio n. 13
0
 public SerializationMonitorExtension(ITypedTable <ISerializationMonitor> registrations)
 => _registrations = registrations;