/// <summary> /// Attempts to create a EdmItemCollection from the specified metadata file /// </summary> public bool TryCreateEdmItemCollection(string sourcePath, string[] referenceSchemas, out EdmItemCollection edmItemCollection) { edmItemCollection = null; if (!ValidateInputPath(sourcePath, _textTransformation)) { return(false); } if (referenceSchemas == null) { referenceSchemas = new string[0]; } ItemCollection itemCollection = null; sourcePath = _textTransformation.Host.ResolvePath(sourcePath); EdmItemCollectionBuilder collectionBuilder = new EdmItemCollectionBuilder(_textTransformation, referenceSchemas.Select(s => _textTransformation.Host.ResolvePath(s)).Where(s => s != sourcePath)); if (collectionBuilder.TryCreateItemCollection(sourcePath, out itemCollection)) { edmItemCollection = (EdmItemCollection)itemCollection; } return(edmItemCollection != null); }
/// <summary> /// Gets the Model Namespace from the provided schema file. /// </summary> public string GetModelNamespace(string sourcePath) { if (String.IsNullOrEmpty(sourcePath)) { throw new ArgumentException("sourcePath"); } if (sourcePath == "$edmxInputFile$") { _textTransformation.Errors.Add(new CompilerError(_textTransformation.Host.TemplateFile ?? "Currently Running Template", 0, 0, "", "Please overwrite the replacement token '$edmxInputFile$' with the actual name of the .edmx file you would like to generate from.")); return String.Empty; } EdmItemCollectionBuilder builder = new EdmItemCollectionBuilder(_textTransformation); XElement model; if (builder.TryLoadRootElement(_textTransformation.Host.ResolvePath(sourcePath), out model)) { XAttribute attribute = model.Attribute("Namespace"); if (attribute != null) { return attribute.Value; } } return String.Empty; }
/// <summary> /// Gets the Model Namespace from the provided schema file. /// </summary> public string GetModelNamespace(string sourcePath) { if (!ValidateInputPath(sourcePath, _textTransformation)) { return String.Empty; } EdmItemCollectionBuilder builder = new EdmItemCollectionBuilder(_textTransformation); XElement model; if (builder.TryLoadRootElement(_textTransformation.Host.ResolvePath(sourcePath), out model)) { XAttribute attribute = model.Attribute("Namespace"); if (attribute != null) { return attribute.Value; } } return String.Empty; }
/// <summary> /// Gets the Model Namespace from the provided schema file. /// </summary> public string GetModelNamespace(string sourcePath) { if (!ValidateInputPath(sourcePath, _textTransformation)) { return(String.Empty); } EdmItemCollectionBuilder builder = new EdmItemCollectionBuilder(_textTransformation); XElement model; if (builder.TryLoadRootElement(_textTransformation.Host.ResolvePath(sourcePath), out model)) { XAttribute attribute = model.Attribute("Namespace"); if (attribute != null) { return(attribute.Value); } } return(String.Empty); }
/// <summary> /// Attempts to create a EdmItemCollection from the specified metadata file /// </summary> public bool TryCreateEdmItemCollection(string sourcePath, string[] referenceSchemas, out EdmItemCollection edmItemCollection) { edmItemCollection = null; if(String.IsNullOrEmpty(sourcePath)) throw new ArgumentException("sourcePath"); if(referenceSchemas == null) referenceSchemas = new string[0]; ItemCollection itemCollection = null; sourcePath = _textTransformation.Host.ResolvePath(sourcePath); var collectionBuilder = new EdmItemCollectionBuilder(_textTransformation, referenceSchemas.Select(s => _textTransformation.Host.ResolvePath(s)).Where(s => s != sourcePath)); if(collectionBuilder.TryCreateItemCollection(sourcePath, out itemCollection)) edmItemCollection = (EdmItemCollection) itemCollection; return edmItemCollection != null; }
/// <summary> /// Attempts to create a EdmItemCollection from the specified metadata file /// </summary> public bool TryCreateEdmItemCollection(string sourcePath, string[] referenceSchemas, out EdmItemCollection edmItemCollection) { edmItemCollection = null; if (!ValidateInputPath(sourcePath, _textTransformation)) { return false; } if (referenceSchemas == null) { referenceSchemas = new string[0]; } ItemCollection itemCollection = null; sourcePath = _textTransformation.Host.ResolvePath(sourcePath); EdmItemCollectionBuilder collectionBuilder = new EdmItemCollectionBuilder(_textTransformation, referenceSchemas.Select(s => _textTransformation.Host.ResolvePath(s)).Where(s => s != sourcePath)); if (collectionBuilder.TryCreateItemCollection(sourcePath, out itemCollection)) { edmItemCollection = (EdmItemCollection)itemCollection; } return edmItemCollection != null; }