示例#1
0
 public DSPStreamProvider2(DSPMediaResourceStorage streamStorage)
     : base(streamStorage)
 {
 }
示例#2
0
            private DSPServiceDefinition PreferHeader_CreateService(DSPMetadata metadata, object existingItem, object existingCollection, object existingStream, object existingNamedStream)
            {
                DSPMediaResourceStorage mrStorage = new DSPMediaResourceStorage();
                DSPServiceDefinition service = new DSPServiceDefinition()
                {
                    Metadata = metadata,
                    CreateDataSource = (m) =>
                    {
                        DSPContext context = new DSPContext();
                        context.GetResourceSetEntities("Items").Add(existingItem);

                        if (existingCollection != null)
                        {
                            context.GetResourceSetEntities("Collection").Add(existingCollection);
                        }

                        if (existingStream != null)
                        {
                            DSPMediaResource defaultStream = mrStorage.CreateMediaResource(existingStream, null);
                            defaultStream.ContentType = UnitTestsUtil.MimeTextPlain;
                            defaultStream.GetWriteStream().WriteByte((int)'c');
                            context.GetResourceSetEntities("Streams").Add(existingStream);
                        }

                        if (existingNamedStream != null)
                        {
                            DSPMediaResource namedStream1 = mrStorage.CreateMediaResource(existingNamedStream, m.GetResourceType("NamedStream").GetNamedStreams().First(ns => ns.Name == "NamedStream1"));
                            namedStream1.ContentType = UnitTestsUtil.MimeTextPlain;
                            namedStream1.GetWriteStream().WriteByte((int)'d');
                            context.GetResourceSetEntities("NamedStreams").Add(existingNamedStream);
                        }

                        return context;
                    },
                    Writable = true,
                    HostInterfaceType = typeof(IDataServiceHost2),
                    SupportMediaResource = true,
                    SupportNamedStream = true,
                    MediaResourceStorage = mrStorage
                };

                return service;
            }
示例#3
0
 /// <summary>
 /// Constructs an instance of the stream provider.
 /// </summary>
 /// <param name="streamCache">Storage for the streams</param>
 public DSPStreamProvider(DSPMediaResourceStorage streamCache)
 {
     this.provider = new DSPStreamProvider2(streamCache);
 }
示例#4
0
 /// <summary>
 /// Constructs an instance of the stream provider.
 /// </summary>
 /// <param name="streamCache">Storage for the streams</param>
 public DSPStreamProvider(DSPMediaResourceStorage streamCache)
 {
     this.provider = new DSPStreamProvider2(streamCache);
 }
示例#5
0
 public DSPStreamProvider2(DSPMediaResourceStorage streamStorage)
     : base(streamStorage)
 {
 }