Пример #1
0
        private void SaveMetadata(string storageTableName, List <Guid> guids, Type context, Type modelType)
        {
            var metadata = new Metadata {
                Guids = guids, ContextName = Util.GetFullyQualifiedTypeName(context), ModelName = Util.GetFullyQualifiedTypeName(modelType)
            };
            var name = $"{storageTableName}-{StorageManagerUtil.METADATA}";

            BlazorDBInterop.SetItem(name, JsonUtil.Serialize(metadata), false);
        }
Пример #2
0
 private static async void SaveMetadata(string storageTableName, List <Guid> guids, Type context, Type modelType,
                                        Metadata oldMetadata)
 {
     var metadata = new Metadata
     {
         Guids       = guids,
         ContextName = Util.GetFullyQualifiedTypeName(context),
         ModelName   = Util.GetFullyQualifiedTypeName(modelType),
         MaxId       = oldMetadata.MaxId
     };
     var name = $"{storageTableName}-{StorageManagerUtil.Metadata}";
     await BlazorDBInterop.SetItem(name, Json.Serialize(metadata), false);
 }
Пример #3
0
        private List <Guid> SaveModels(object storageSetValue, Type modelType, string storageTableName, List <PropertyInfo> storageSets)
        {
            var guids          = new List <Guid>();
            var storageSetType = StorageManagerUtil.genericStorageSetType.MakeGenericType(modelType);
            var method         = storageSetType.GetMethod(StorageManagerUtil.GET_ENUMERATOR);
            var enumerator     = (IEnumerator)method.Invoke(storageSetValue, new object[] { });

            while (enumerator.MoveNext())
            {
                var guid = Guid.NewGuid();
                guids.Add(guid);
                var model           = enumerator.Current;
                var name            = $"{storageTableName}-{guid}";
                var serializedModel = ScanModelForAssociations(model, storageSets, JsonUtil.Serialize(model));
                BlazorDBInterop.SetItem(name, serializedModel, false);
            }
            return(guids);
        }