Exemplo n.º 1
0
 public DSPStreamProvider2(DSPMediaResourceStorage streamStorage)
     : base(streamStorage)
 {
 }
Exemplo n.º 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;
            }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 public DSPStreamProvider2(DSPMediaResourceStorage streamStorage)
     : base(streamStorage)
 {
 }