protected override RepositoryInstance CreateRepository(RepositoryConfiguration configuration) { switch (configuration.RepositoryKind) { case "Azure": throw new NotImplementedException(); case "Raven Embedded": throw new NotImplementedException(); case "Raven Client": throw new NotImplementedException(); case "SharePoint": throw new NotImplementedException(); case "SharePoint Client": throw new NotImplementedException(); default: if (configuration.Options.ContainsKey("path") == false) { throw new InvalidOperationException("FSDocument Store requires a 'path' variable passed as a config option."); } var fs = new FSDocumentStore(configuration.Options["path"]); var repository = new Repository(fs); return(new RepositoryInstance(this.Engine, repository)); } }
protected override RepositoryInstance CreateRepository(RepositoryConfiguration configuration) { switch (configuration.RepositoryKind) { default: if (configuration.Options.ContainsKey("path") == false) { throw new InvalidOperationException("FSDocument Store requires a 'path' variable passed as a config option."); } var factory = new SPDocumentStore(); var repository = new Repository(factory); return(new RepositoryInstance(this.Engine, repository)); } }
public virtual RepositoryInstance GetRepository(object config) { var configuration = new RepositoryConfiguration(); if (config is ObjectInstance) { var objConfig = config as ObjectInstance; if (objConfig.HasProperty("containerName")) { configuration.ContainerName = TypeConverter.ToString(objConfig.GetPropertyValue("containerName")); } if (objConfig.HasProperty("repositoryKind")) { configuration.RepositoryKind = TypeConverter.ToString(objConfig.GetPropertyValue("repositoryKind")); } if (objConfig.HasProperty("options")) { var objOptions = objConfig.GetPropertyValue("options") as ObjectInstance; if (objOptions != null) { foreach (var kvp in objOptions.Properties.Where(kvp => configuration.Options.ContainsKey(kvp.Name) == false)) { configuration.Options.Add(kvp.Name, TypeConverter.ToString(kvp.Value)); } } } } else { configuration.ContainerName = TypeConverter.ToString(config); } return(CreateRepository(configuration)); }
protected abstract RepositoryInstance CreateRepository(RepositoryConfiguration configuration);