/// <summary> /// Loads a project from the repository returning back the details. /// </summary> /// <param name="site">The <see cref="Uri"/> of the project site.</param> /// <returns>The <see cref="Services.Contracts.Project"/> that exists at the specified <see cref="Uri"/>.</returns> public Services.Contracts.Project LoadProject(Uri site) { RoughCutEditorEntities context = null; Project project = null; try { context = new RoughCutEditorEntities(); context.CommandTimeout = DefaultCommandTimeout; var projectId = ExtractIdFromUri(site); project = LoadProject(projectId, context); if (project == null) { return(new Services.Contracts.Project()); } } finally { if (context != null) { context.Dispose(); } } return(SqlDataProviderTranslator.ConvertToProject(project, this.metadataLocator)); }
public void ShouldConvertSqlProjectToProject() { var sqlProject = SqlHelper.CreateSqlProject(); var project = SqlDataProviderTranslator.ConvertToProject(sqlProject); SqlHelper.AssertProject(sqlProject, project); }
/// <summary> /// Loads a project from the repository returning back the details. /// </summary> /// <param name="site">The <see cref="Uri"/> of the project site.</param> /// <returns>The <see cref="Services.Contracts.Project"/> that exists at the specified <see cref="Uri"/>.</returns> public Services.Contracts.Project LoadProject(Uri site) { RoughCutEditorEntities context = new RoughCutEditorEntities { CommandTimeout = DefaultCommandTimeout }; string projectUriString = site.ToString(); Project project = LoadProject(projectUriString, context); if (project == null) { return(new Services.Contracts.Project()); } return(SqlDataProviderTranslator.ConvertToProject(project)); }