Exemplo n.º 1
0
 private static void Init()
 {
     if (IsInitiated)
     {
         return;
     }
     foreach (var clrClass in typeof(SQLiteTable).GetConcreteSubclasses())
     {
         TableMapping.CreateMapping(clrClass).Wait();
     }
     IsInitiated = true;
 }
Exemplo n.º 2
0
 /// <inheritdoc />
 protected override IEnumerable <IProceduralEntityResource> SelectProceduralResources()
 {
     foreach (var resource in SQLite <ProceduralResource> .Select().ToEnumerable())
     {
         var type = resource.Type;
         if (type != null)
         {
             if (TableMapping.GetTableMapping(type) == null)
             {
                 TableMapping.CreateMapping(type).Wait();
             }
             yield return(resource);
         }
     }
 }
Exemplo n.º 3
0
        /// <inheritdoc />
        protected override IProceduralEntityResource InsertProceduralResource(string name, string description, Method[] methods, dynamic data)
        {
            var resource = new ProceduralResource
            {
                Name         = name,
                Description  = description,
                Methods      = methods,
                BaseTypeName = data.BaseTypeName ?? throw new SQLiteException("No BaseTypeName defined in 'Data' in resource controller")
            };
            var resourceType = resource.Type;

            if (resourceType == null)
            {
                throw new SQLiteException(
                          $"Could not locate basetype '{resource.BaseTypeName}' when building procedural resource '{resource.Name}'. " +
                          "Was the assembly modified between builds?");
            }
            TableMapping.CreateMapping(resourceType).Wait();
            SQLite <ProceduralResource> .Insert(resource).Wait();

            return(resource);
        }