コード例 #1
0
ファイル: DataProvider.cs プロジェクト: rossmcewan/indoorworx
        /// <summary>
        /// Loads a <see cref="TitleTemplate"/> from the repository.
        /// </summary>
        /// <returns>The <see cref="TitleTemplateCollection"/> of the titles template that were loaded.</returns>
        public TitleTemplateCollection LoadTitleTemplates()
        {
            RoughCutEditorEntities context = new RoughCutEditorEntities {
                CommandTimeout = DefaultCommandTimeout
            };

            List <TitleTemplate> titleTemplates = context.TitleTemplate.ToList();

            return(SqlDataProviderTranslator.ConvertToTitleTemplates(titleTemplates));
        }
コード例 #2
0
        public void ShouldConvertListOfSqlTitleTemplatesToTitleCollection()
        {
            var sqlTitleTemplates = new List <SqlTitleTemplate>();

            sqlTitleTemplates.Add(SqlHelper.CreateSqlTitleTemplate());
            sqlTitleTemplates.Add(SqlHelper.CreateSqlTitleTemplate());

            var titleTemplates = SqlDataProviderTranslator.ConvertToTitleTemplates(sqlTitleTemplates);

            SqlHelper.AssertTitleTemplate(titleTemplates[0], sqlTitleTemplates[0]);
            SqlHelper.AssertTitleTemplate(titleTemplates[1], sqlTitleTemplates[1]);
        }
コード例 #3
0
        /// <summary>
        /// Loads a <see cref="TitleTemplate"/> from the repository.
        /// </summary>
        /// <returns>The <see cref="TitleTemplateCollection"/> of the titles template that were loaded.</returns>
        public TitleTemplateCollection LoadTitleTemplates()
        {
            RoughCutEditorEntities context        = null;
            List <TitleTemplate>   titleTemplates = null;

            try
            {
                context = new RoughCutEditorEntities();
                context.CommandTimeout = DefaultCommandTimeout;
                titleTemplates         = context.TitleTemplate.ToList();
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }

            return(SqlDataProviderTranslator.ConvertToTitleTemplates(titleTemplates));
        }