private ContentListType ManageContentListType(Dictionary <string, FieldDescriptor> fieldInfoList, Dictionary <string, List <string> > oldBindings, bool modify, out List <FieldSetting> fieldSettings) { var attempts = 0; while (true) { try { return(ManageContentListTypeOneAttempt(fieldInfoList, oldBindings, modify, out fieldSettings)); } catch (Exception e) { if (!(e.Message.Contains("Storage schema is out of date") || e.Message.Contains("Schema is locked by someone else")) || attempts++ >= 42) { throw; } } var timer = Stopwatch.StartNew(); StorageSchema.Reload(); ContentTypeManager.Reload(); timer.Stop(); var d = timer.Elapsed; var timeString = $"{d.Minutes}:{d.Seconds}.{d.Milliseconds}"; SnLog.WriteInformation( $"Type system is reloaded because it was out of date during managing a list type. Attempt: {attempts}, reloading time: {timeString}", EventId.RepositoryRuntime); } }
/// <summary> /// Loads metadata and mapping information from the given path into an <see cref="Edmx"/> instance. /// </summary> /// <param name="edmx">The <see cref="Edmx"/> instance in which to load metadata from the given path.</param> /// <param name="splitPath">An non-delimited, i.e. split, path from which to load metadata.</param> /// <returns>An edmx instance loaded with metadata from the given <paramref name="splitPath"/>.</returns> private static Edmx Load(Edmx edmx, string splitPath) { if (splitPath.StartsWith(ResourceSchemeString)) { return(LoadFromEmbeddedResource(edmx, splitPath)); } if (MapToMetadataFileType(splitPath) == MetadataFileType.ConceptualModel) { edmx.Runtimes.First().ConceptualModels.ConceptualSchema = ConceptualSchema.Load(splitPath); return(edmx); } if (MapToMetadataFileType(splitPath) == MetadataFileType.StorageModel) { edmx.Runtimes.First().StorageModels.StorageSchema = StorageSchema.Load(splitPath); return(edmx); } if (MapToMetadataFileType(splitPath) == MetadataFileType.Mapping) { edmx.Runtimes.First().Mappings.Mapping = Mapping.Load(splitPath); return(edmx); } if (MapToMetadataFileType(splitPath) == MetadataFileType.Edmx) { return(XTypedServices.Load <Edmx, TEdmx>(splitPath, LinqToXsdTypeManager.Instance)); } throw new ArgumentException(String.Format("The path argument '{0}' must represent a path to an edmx, csdl, ssdl or msl file.", splitPath)); }
public bool isOfType(string cell_type_name) { ushort cell_type = (ushort)StorageSchema.GetCellType(cell_type_name); long cid = CellGroupUtil.GetCellID(cell_id, cell_type); var generic_child = Global.LocalStorage.UseGenericCell(cid, CellAccessOptions.ReturnNullOnCellNotFound); if (generic_child == null) { return(false); } generic_child.Dispose(); return(true); }
public T Cast <T>() where T : ICellAccessor { ushort cell_type; string cell_type_name = typeof(T).Name; cell_type_name = cell_type_name.Substring(0, cell_type_name.Length - 9); cell_type = (ushort)StorageSchema.GetCellType(cell_type_name); long cid = CellGroupUtil.GetCellID(cell_id, cell_type); var generic_child = Global.LocalStorage.UseGenericCell(cid, CellAccessOptions.ReturnNullOnCellNotFound); if (generic_child == null) { return(default(T)); } return((T)generic_child); }
private static Edmx Load(Edmx edmx, MetadataFileType fileType, Stream metadataStream) { switch (fileType) { case MetadataFileType.ConceptualModel: edmx.Runtimes.First().ConceptualModels.ConceptualSchema = ConceptualSchema.Load(metadataStream); return(edmx); case MetadataFileType.StorageModel: edmx.Runtimes.First().StorageModels.StorageSchema = StorageSchema.Load(metadataStream); return(edmx); case MetadataFileType.Mapping: edmx.Runtimes.First().Mappings.Mapping = Mapping.Load(metadataStream); return(edmx); case MetadataFileType.Edmx: return(Load(metadataStream)); default: throw new ArgumentException(String.Format("The fileType '{0}' must represent an edmx, csdl, ssdl or msl file.", fileType)); } }
public SecurityInstaller(SecurityHandler securityHandler, StorageSchema storageSchema, IDataStore dataStore) { _securityHandler = securityHandler; _storageSchema = storageSchema; _dataStore = dataStore; }