Beispiel #1
0
        static void Main(string[] args)
        {
            var originalObject = new StoreObject()
            {
                DateTimeValue = DateTime.Now,
                DoubleValue   = 11.33,
                IntegerValue  = 1133,
                StringValue   = "String message",
                StringList    = new string[100].Select(s => SGuid.ShortUID()).ToList(),
                StreamValue   = new MemoryStream(File.ReadAllBytes(Directory.GetFiles(".").First()))
            };

            var objectId = $"ID-{SGuid.ShortUID()}";

            var db = new SqliteStorage("obj_storage.db", "O3");

            db.InitDb();

            Console.WriteLine("Insert...");
            db.Insert(originalObject, objectId);

            Console.WriteLine("Upsert...");
            db.Upsert(originalObject, objectId);

            Console.WriteLine("Select...");
            var recoveryObject = db.Select <StoreObject>(objectId);

            Console.WriteLine("Delete...");
            db.Delete(objectId);

            Console.WriteLine($"Success!");
            Console.ReadLine();
        }
 public SyntaxArgument(Symbol name, bool isRest = false)
 {
     Original = name;
     IsRest   = isRest;
     Replaced = new Symbol($"{name.Name}-{SGuid.ShortUID()}");
 }