当前位置: 首页>>代码示例>>C#>>正文


C# IObjectContainer.Commit方法代码示例

本文整理汇总了C#中IObjectContainer.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# IObjectContainer.Commit方法的具体用法?C# IObjectContainer.Commit怎么用?C# IObjectContainer.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IObjectContainer的用法示例。


在下文中一共展示了IObjectContainer.Commit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Exercise

			protected override void Exercise(IObjectContainer db)
			{
				Assert.AreEqual(1, db.Query(typeof(ConcurrentRenameTestCase.QueryItem)).Count);
				ConcurrentRenameTestCase.QueryItem newItem = new ConcurrentRenameTestCase.QueryItem
					();
				db.Store(newItem);
				db.Commit();
				db.Delete(newItem);
				db.Commit();
			}
开发者ID:superyfwy,项目名称:db4o,代码行数:10,代码来源:ConcurrentRenameTestCase.cs

示例2: cadastrarCliente

 public Boolean cadastrarCliente(Cliente objCliente)
 {
     objCliente.Codigo = obtemNovoId();
     try
     {
         if (!temDuplicidade(objCliente, "Cadastrar"))
         {
             db = ServidorSingleton.obterServidor().OpenClient();
             db.Store(objCliente);
             db.Commit();
             return true;
         }
         else {
             return false;
         }
     }
     catch(Exception e)
     {
         throw new Exception("Erro cadastrando o cliente :" + e.Message);
     }
     finally {
         db.Close();
         db.Dispose();
     }
 }
开发者ID:fbsharp,项目名称:Projetos,代码行数:25,代码来源:ClienteDAO.cs

示例3: SetUp

		public void SetUp()
		{
			_filePath = Path.GetTempFileName();
			//Db4objects.Db4o.Config.IConfiguration db4oConfiguration = Db4oFactory.Configure();
			//Db4objects.Db4o.Config.IObjectClass objectClass = db4oConfiguration.ObjectClass(typeof(LanguageForm));
			// objectClass.ObjectField("_writingSystemId").Indexed(true);
			// objectClass.ObjectField("_form").Indexed(true);

			_db = Db4oFactory.OpenFile(_filePath);
			((YapStream) _db).GetNativeQueryHandler().QueryOptimizationFailure +=
					OnQueryOptimizationFailure;

			for (int i = 0;i < 10000;i++)
			{
				Entry e = new Entry();
				e.name = new MultiText();
				e.name._forms[0] = new LanguageForm("en", "en-" + i);
				//e.name._forms[1] = new LanguageForm("fr", "fr-"+i);
				e.name._singleForm = new LanguageForm("en", i.ToString());
				_db.Set(e);
			}

			_db.Commit();
			_db.Dispose();
			_db = Db4oFactory.OpenFile(_filePath);
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:26,代码来源:Db4oQueryPerformance.cs

示例4: alterarStatus

        public Boolean alterarStatus(clsStatus objAtualizar)
        {
            try
            {
                if (!temDuplicidade(objAtualizar, "Alterar"))
                {
                    clsStatus objStatusBuscar = new clsStatus();

                    objStatusBuscar.Codigo = objAtualizar.Codigo;
                    db = ServidorSingleton.obterServidor().OpenClient();
                    IObjectSet leitor = db.QueryByExample(objStatusBuscar);

                    clsStatus objStatus = (clsStatus)leitor.Next();
                    objStatus.Descricao = objAtualizar.Descricao;
                    db.Store(objStatus);
                    db.Commit();
                    db.Close();
                    db.Dispose();
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Erro atualizando o status :" + ex.ToString());
            }
        }
开发者ID:fbsharp,项目名称:Projetos,代码行数:30,代码来源:StatusDAO.cs

示例5: cadastrarStatus

 public Boolean cadastrarStatus(clsStatus objStatus)
 {
     try
     {
         if (!temDuplicidade(objStatus, "Cadastrar"))
         {
             objStatus.Codigo = obtemNovoId(); //Executa a solicitação de um novo id
             db = ServidorSingleton.obterServidor().OpenClient();
             db.Store(objStatus);
             db.Commit();
             return true;
         }
         else {
             return false;
         }
     }
     catch (Exception ex)
     {
         db.Rollback();
         throw new Exception("Erro cadastrando o status :" + ex.ToString());
     }
     finally {
         db.Close();
         db.Dispose();
     }
 }
开发者ID:fbsharp,项目名称:Projetos,代码行数:26,代码来源:StatusDAO.cs

示例6: StoreCarCommit

 public static void StoreCarCommit(IObjectContainer db)
 {
     Pilot pilot = new Pilot("Rubens Barrichello", 99);
     Car car = new Car("BMW");
     car.Pilot = pilot;
     db.Store(car);
     db.Commit();
 }
开发者ID:erdincay,项目名称:db4o,代码行数:8,代码来源:TransactionExample.cs

示例7: StoreObjects

 private static void StoreObjects(IObjectContainer container)
 {
     Random rnd = new Random();
     for (int i = 0; i < 500000; i++)
     {
         container.Store(new DataObject(rnd));
     }
     container.Commit();
 }
开发者ID:superyfwy,项目名称:db4o,代码行数:9,代码来源:ReferenceSystemMonitoring.cs

示例8: alterarFuncionario

        public Boolean alterarFuncionario(Funcionario objFuncionarioAlterar)
        {
            try
            {
                if (!temDuplicidade(objFuncionarioAlterar, "Alterar"))
                {
                    db = ServidorSingleton.obterServidor().OpenClient();
                    Funcionario objFuncionarioProt = FactoryClasses.criarFuncionario();
                    objFuncionarioProt.Codigo = objFuncionarioAlterar.Codigo;
                    IObjectSet leitor = db.QueryByExample(objFuncionarioProt);
                    if (leitor.HasNext())
                    {
                        Funcionario objFuncionario = (Funcionario)leitor.Next();
                        //Atribui o cargo
                        IObjectSet leitorCargo = db.QueryByExample(objFuncionarioAlterar.Cargo);
                        if (leitorCargo.HasNext())
                        {
                            Cargo objCargo = (Cargo)leitorCargo.Next();
                            objFuncionario.Cargo = objCargo;
                        }
                        leitorCargo = null;

                        objFuncionario.DataAdmissao = objFuncionarioAlterar.DataAdmissao;
                        objFuncionario.DataDemissao = objFuncionarioAlterar.DataDemissao;
                        objFuncionario.Email = objFuncionarioAlterar.Email;
                        objFuncionario.Login = objFuncionarioAlterar.Login;
                        objFuncionario.Nome = objFuncionarioAlterar.Nome;
                        objFuncionario.Senha = objFuncionarioAlterar.Senha;
                        objFuncionario.Telefone = objFuncionarioAlterar.Telefone;
                        db.Store(objFuncionario);
                        db.Commit();
                        leitor = null;
                        return true;
                    }
                    else
                    {
                        leitor = null;
                        return false;
                    }

                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                db.Rollback();
                throw new Exception("Erro atualizando o funcionario :" + ex.ToString());
            }
            finally
            {
                db.Close();
                db.Dispose();
            }
        }
开发者ID:fbsharp,项目名称:Projetos,代码行数:57,代码来源:FuncionarioDAO.cs

示例9: RollbackChanges

        private static void RollbackChanges(IObjectContainer container)
        {
            // #example: Commit changes
            container.Store(new Pilot("John"));
            container.Store(new Pilot("Joanna"));

            container.Commit();
            // #end example
        }
开发者ID:Galigator,项目名称:db4o,代码行数:9,代码来源:Transactions.cs

示例10: TryToFragmentDatabase

 private static void TryToFragmentDatabase(IObjectContainer container)
 {
     while (!Console.KeyAvailable)
     {
         Random rnd = new Random();
         StoreData(container, rnd);
         DeleteData(container, rnd);
         container.Commit();
     }
 }
开发者ID:superyfwy,项目名称:db4o,代码行数:10,代码来源:FreespaceMonitoring.cs

示例11: WorkWithObjects

 private static void WorkWithObjects(IObjectContainer container)
 {
     while (!Console.KeyAvailable)
     {
         Random rnd = new Random();
         StoreData(container, rnd);
         DeleteData(container, rnd);
         container.Commit();
     }
 }
开发者ID:Galigator,项目名称:db4o,代码行数:10,代码来源:ObjectLifecycleMonitoring.cs

示例12: Setup

        public static void Setup()
        {
            if(File.Exists(Constants.DatabasePath))
            {
                File.Delete(Constants.DatabasePath);
            }
            _db = Db4oFactory.OpenFile(Constants.DatabasePath);

            var settings = new Settings();
            settings.ScreenName = "detroitpro";

            _db.Store(settings);
            _db.Commit();
        }
开发者ID:detroitpro,项目名称:ProStudioTweet,代码行数:14,代码来源:Default_Tests.cs

示例13: atualizarSolicitacao

        public Boolean atualizarSolicitacao(SolicitacaoMateriais objSolicitacao)
        {
            SolicitacaoMateriais objSolicitacaoProt = FactoryClasses.criarSolicitacaoMateriais();
            objSolicitacaoProt.Codigo = objSolicitacao.Codigo;
            try
            {
                db = ServidorSingleton.obterServidor().OpenClient();
                IObjectSet leitor = db.QueryByExample(objSolicitacaoProt);
                if (leitor.HasNext())
                {
                    SolicitacaoMateriais objSolicitacaoCache = (SolicitacaoMateriais)leitor.Next();
                    objSolicitacaoCache.GestorObra = objSolicitacao.GestorObra;

                    int i = 0;
                    foreach (Materiais material in objSolicitacaoCache.Materiais) {
                        if (material.Codigo == objSolicitacao.Codigo) {
                            Fornecedor objFornecedor = FactoryClasses.criarFornecedor();
                            objFornecedor.Codigo = objSolicitacao.Materiais[i].Fornecedor.Codigo;
                            material.Fornecedor = objFornecedor;
                        }
                        i++;
                    }

                    objSolicitacaoCache.Materiais = objSolicitacao.Materiais;
                    objSolicitacaoCache.Status = objSolicitacao.Status;
                    objSolicitacaoCache.DataEntrega = objSolicitacao.DataEntrega;
                    objSolicitacaoCache.NumNotaFiscal = objSolicitacao.NumNotaFiscal;
                    objSolicitacaoCache.DataEntrega = objSolicitacao.DataEntrega;
                    objSolicitacaoCache.Msg = objSolicitacao.Msg;
                    db.Store(objSolicitacaoCache);
                    db.Commit();
                    db.Close();
                    db.Dispose();
                    return true;
                }
                else
                {
                    db.Close();
                    db.Dispose();
                    return false;
                }
            }
            catch (Exception e)
            {
                db.Rollback();
                db.Close();
                db.Dispose();
                throw new Exception("Erro atualizando a solicitação :" + e.Message);
            }
        }
开发者ID:fbsharp,项目名称:Projetos,代码行数:50,代码来源:SolicitacaoMateriaisDAO.cs

示例14: alterarFilme

        public Boolean alterarFilme(clsFilme objAtualizar)
        {
            try
            {
                db = ServidorSingleton.obterServidor().OpenClient();
                clsFilme filmeBuscar = new clsFilme();
                filmeBuscar.Codigo = objAtualizar.Codigo;
                IObjectSet leitor = db.QueryByExample(filmeBuscar);
                if (leitor.HasNext())
                {
                    clsFilme objFilme = (clsFilme)leitor.Next();
                    objFilme.Ano = objAtualizar.Ano;
                    objFilme.Avaliacao = objAtualizar.Avaliacao;
                    objFilme.TituloBr = objAtualizar.TituloBr;
                    objFilme.TituloOriginal = objAtualizar.TituloOriginal;

                    IObjectSet leitorGenero = db.QueryByExample(objAtualizar.Genero);
                    if (leitorGenero.HasNext()) {
                        objFilme.Genero = (clsGenero)leitorGenero.Next();
                    }
                    leitorGenero = null;

                    IObjectSet leitorStatus = db.QueryByExample(objAtualizar.Status);
                    if (leitorStatus.HasNext())
                    {
                        objFilme.Status = (clsStatus)leitorStatus.Next();
                    }
                    leitorStatus = null;

                    db.Store(objFilme);
                    db.Commit();
                    return true;
                }
                else
                {
                    return false;
                }
                leitor = null;
            }
            catch (Exception ex)
            {
                db.Rollback();
                throw new Exception("Erro atualizando o filme :" + ex.ToString());
            }
            finally {
                db.Close();
                db.Dispose();
            }
        }
开发者ID:fbsharp,项目名称:Projetos,代码行数:49,代码来源:FilmeDAO.cs

示例15: DeleteAndReadd

 private void DeleteAndReadd(IObjectContainer db, Collection4 removed)
 {
     var removeIter = removed.GetEnumerator();
     while (removeIter.MoveNext())
     {
         db.Delete(removeIter.Current);
     }
     db.Commit();
     var readdIter = removed.GetEnumerator();
     while (readdIter.MoveNext())
     {
         db.Store(readdIter.Current);
     }
     db.Commit();
 }
开发者ID:masroore,项目名称:db4o,代码行数:15,代码来源:BlockSizeDefragTestCase.cs


注:本文中的IObjectContainer.Commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。