コード例 #1
0
        /// <summary>
        /// Loads the MediaBin <see cref="Container" /> with a <see cref="ItemCollection" /> that contains the items in the media bin.
        /// </summary>
        /// <param name="mediaBinUri">The <see cref="Uri"/> of the media bin to load.</param>
        /// <returns>A <see cref="Container"/> with the media elements for the project.</returns>
        public Services.Contracts.MediaBin LoadMediaBin(Uri mediaBinUri)
        {
            Container mediaBin             = null;
            RoughCutEditorEntities context = null;

            try
            {
                context = new RoughCutEditorEntities();
                context.CommandTimeout = 180;

                var id = ExtractIdFromUri(mediaBinUri);

                mediaBin =
                    context.Container.Include("Items")
                    .Include("Items.Resources")
                    .Include("Items.Resources.VideoFormat")
                    .Include("Items.Resources.AudioFormat")
                    .Include("Items.Resources.ImageFormat")
                    .Include("Containers")
                    .Where(x => x.Id == id)
                    .FirstOrDefault();
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }

            return(SqlDataProviderTranslator.ConvertToMediaBin(mediaBin, this.metadataLocator));
        }
コード例 #2
0
ファイル: DataProvider.cs プロジェクト: rossmcewan/indoorworx
        /// <summary>
        /// Loads the MediaBin <see cref="Container" /> with a <see cref="ItemCollection" /> that contains the items in the media bin.
        /// </summary>
        /// <param name="mediaBinUri">The <see cref="Uri"/> of the media bin to load.</param>
        /// <returns>A <see cref="Container"/> with the media elements for the project.</returns>
        public Services.Contracts.MediaBin LoadMediaBin(Uri mediaBinUri)
        {
            RoughCutEditorEntities context = new RoughCutEditorEntities {
                CommandTimeout = 180
            };

            string uriString = mediaBinUri.ToString();

            Container mediaBin = context.Container
                                 .Include("Items")
                                 .Include("Items.Resources")
                                 .Include("Items.Resources.VideoFormat")
                                 .Include("Items.Resources.AudioFormat")
                                 .Include("Items.Resources.ImageFormat")
                                 .Include("Containers")

                                 // .Include("Containers.Items")
                                 // .Include("Containers.Items.Resources")
                                 // .Include("Containers.Items.Resources.VideoFormat")
                                 // .Include("Containers.Items.Resources.AudioFormat")
                                 // .Include("Containers.Items.Resources.ImageFormat")
                                 .Where(x => x.Id == uriString)
                                 .FirstOrDefault();

            return(SqlDataProviderTranslator.ConvertToMediaBin(mediaBin));
        }
コード例 #3
0
        public void ShouldConvertSqlContainerToAMediaBin()
        {
            var sqlContainer = SqlHelper.CreateSqlContainer();

            var mediaBin = SqlDataProviderTranslator.ConvertToMediaBin(sqlContainer);

            SqlHelper.AssertContainer(sqlContainer, mediaBin);
        }