Advertisement
Mushi

db4o com C# - Exemplo

Jan 31st, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Db4objects.Db4o;
  7. using Db4objects.Db4o.Linq;
  8.  
  9. namespace ConsoleApplication7
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             IEmbeddedObjectContainer container = Db4oEmbedded.OpenFile("nome_app.yap");
  16.             //Pessoa pessoa = new Pessoa();
  17.             //pessoa.nome = "Julio";
  18.             //pessoa.idade = 13;
  19.             //container.Store(pessoa);
  20.  
  21.             /*IList<Pessoa> pessoas = container.Query(delegate(Pessoa p)
  22.             {
  23.                 return p.idade > 0;
  24.                 //return p.nome.StartsWith("P");
  25.             });*/
  26.  
  27.             //IEnumerable<Pessoa> pessoas = from Pessoa p in container where p.nome.StartsWith("P") || p.nome.StartsWith("M") select p;
  28.             IEnumerable<Pessoa> pessoas = from Pessoa p in container where p.nome.StartsWith("E") select p;
  29.  
  30.             foreach(Pessoa p in pessoas)
  31.             {
  32.                 //p.nome = "Edmiel";
  33.                 //container.Store(p);
  34.                 //container.Delete(p);
  35.                 Console.WriteLine(p.nome);
  36.             }
  37.            
  38.  
  39.             Console.ReadKey();
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement