csharp
using VelocityDb;
using VelocityDb.Session;
class Program
{
static void Main()
{
using (SessionNoServer session = new SessionNoServer("path-to-your-db-directory"))
{
session.BeginUpdate();
Database myDatabase = new Database(session);
session.Persist(myDatabase);
session.Commit();
}
}
}
csharp
using VelocityDb;
using VelocityDb.Collection.Comparer;
using VelocityDb.Collection.BTree;
using VelocityDb.TypeInfo;
using VelocityDb.Session;
[Serializable]
public class Person : OptimizedPersistable
{
string name;
int age;
public Person(string name, int age)
{
this.name = name;
this.age = age;
}
public string Name { get => name; set => name = value; }
public int Age { get => age; set => age = value; }
}
csharp
using VelocityDb;
using VelocityDb.Collection.Comparer;
using VelocityDb.Collection.BTree;
using VelocityDb.TypeInfo;
using VelocityDb.Session;
class Program
{
static void Main()
{
using (SessionNoServer session = new SessionNoServer("path-to-your-db-directory"))
{
session.BeginUpdate();
Database myDatabase = new Database(session);
session.Persist(myDatabase);
Person person = new Person("John", 30);
session.Persist(person);
session.Commit();
}
}
}
csharp
using VelocityDb;
using VelocityDb.Collection.Comparer;
using VelocityDb.Collection.BTree;
using VelocityDb.TypeInfo;
using VelocityDb.Session;
class Program
{
static void Main()
{
using (SessionNoServer session = new SessionNoServer("path-to-your-db-directory"))
{
session.BeginRead();
Person person = session.AllObjects<Person>().FirstOrDefault();
Console.WriteLine($"Name: {person.Name}, Age: {person.Age}");
session.Commit();
}
}
}
csharp
using VelocityDb;
using VelocityDb.Collection.Comparer;
using VelocityDb.Collection.BTree;
using VelocityDb.TypeInfo;
using VelocityDb.Session;
class Program
{
static void Main()
{
using (SessionNoServer session = new SessionNoServer("path-to-your-db-directory"))
{
session.BeginUpdate();
Person person = session.AllObjects<Person>().FirstOrDefault();
Console.WriteLine($"Current Name: {person.Name}, Age: {person.Age}");
person.Name = "Tom";
person.Age = 35;
session.Commit();
}
}
}