Exemplo n.º 1
0
        public virtual void BatchInsert(IEnumerable <T> objects, string entity, XElement schema)
        {
            XElement entitySchema = schema.GetEntitySchema(entity);

            Dictionary <string, object>[] dicts = ToDictionaries(objects, entitySchema);

            CheckAutoIncrement(dicts, entity, entitySchema);

            IEnumerable <BatchStatement> statments =
                ModificationGenerator.GenerateBatchInsertStatements(dicts, entitySchema);

            Persist(statments, false, null, null, null);
        }
Exemplo n.º 2
0
        public virtual void BatchUpdate(IEnumerable <T> objects, string entity, XElement schema)
        {
            XElement entitySchema      = schema.GetEntitySchema(entity);
            XElement keySchema         = schema.GetKeySchema(entity);
            XElement concurrencySchema = schema.GetConcurrencySchema(entity);

            Dictionary <string, object>[] dicts = ToDictionaries(objects, entitySchema);

            IEnumerable <BatchStatement> statments =
                ModificationGenerator.GenerateBatchUpdateStatements(dicts, entitySchema, keySchema, concurrencySchema);

            Persist(statments, concurrencySchema != null, dicts, entity, keySchema);
        }
        public virtual async Task BatchUpdateAsync(IEnumerable <T> objects, string entity, T value, XElement schema)
        {
            XElement entitySchema      = schema.GetEntitySchema(entity);
            XElement keySchema         = schema.GetKeySchema(entity);
            XElement concurrencySchema = schema.GetConcurrencySchema(entity);

            Dictionary <string, object>[] dicts     = ToDictionaries(objects, entitySchema);
            Dictionary <string, object>   valueDict = ToDictionary(value, entitySchema);

            IEnumerable <BatchStatement> statments =
                ModificationGenerator.GenerateBatchUpdateStatements(dicts, valueDict, entitySchema, keySchema, concurrencySchema);

            await PersistAsync(statments, concurrencySchema != null, dicts, entity, keySchema);
        }