Host.cs :  » Bloggers » dasBlog » DasBlog » Services » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Bloggers » dasBlog 
dasBlog » DasBlog » Services » Host.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel;
using dasBlog.Storage;
using dasBlog.Storage.SqlServer;
using dasBlog.Storage.Ntfs;

namespace dasBlog.Services{
    public class Host : CommunicationObject
    {

        Uri[] baseAddresses;
        Dictionary<string, EndpointAddress> hostedServices = new Dictionary<string, EndpointAddress>();

        public Host(params Uri[] baseAddresses)
        {
            this.baseAddresses = baseAddresses;
        }

        void RegisterHostedService(string name, EndpointAddress address )
        {
            hostedServices.Add(name, address);
        }


        public void CreateBlog(string blogScope)
        {
            IStorageNode textEntryNode = StorageNodeFactory.CreateStorageNode<TextEntryStorageProvider>();
            IStorageNode streamNode = StorageNodeFactory.CreateStorageNode<StreamStorageProvider>(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ".\\content"));

            CreateBlog(blogScope, textEntryNode, streamNode);
        }

        public void CreateBlog(string blogScope, IStorageNode textEntryNode, IStorageNode streamNode)
        {
            StorageBus bus = StorageBus.Current;

            var posts = new NodeDescription(textEntryNode);
            var pictures = new NodeDescription(streamNode);
            var media = new NodeDescription(streamNode);
            
            posts.Paths.Add(PathSegmentName.Comments, posts);
            posts.Paths.Add(PathSegmentName.Annotations, posts);
            posts.Paths.Add(PathSegmentName.Media, media);
            posts.Paths.Add(PathSegmentName.Pictures, pictures);

            pictures.Paths.Add(PathSegmentName.Comments, posts);
            pictures.Paths.Add(PathSegmentName.Annotations, posts);

            media.Paths.Add(PathSegmentName.Comments, posts);
            media.Paths.Add(PathSegmentName.Annotations, posts);

            ScopeDescription scope = new ScopeDescription(blogScope);
            scope.Paths.Add(PathSegmentName.Posts, posts);
            scope.Paths.Add(PathSegmentName.Pictures, pictures);
            scope.Paths.Add(PathSegmentName.Media, media);
            bus.AddStorageScope(scope);
            
        }

        public void CreateAlbum(string albumScope, IStorageNode textEntryNode, IStorageNode tagNode, IStorageNode streamNode)
        {
            StorageBus bus = StorageBus.Current;

            var comments = new NodeDescription(textEntryNode);
            var pictures = new NodeDescription(streamNode);
            
            pictures.Paths.Add(PathSegmentName.Comments, comments);
            pictures.Paths.Add(PathSegmentName.Annotations, comments);

            ScopeDescription scope = new ScopeDescription(albumScope);
            scope.Paths.Add(PathSegmentName.Pictures, pictures);

            bus.AddStorageScope(scope);
        }
        
        protected override TimeSpan DefaultCloseTimeout
        {
            get { throw new NotImplementedException(); }
        }

        protected override TimeSpan DefaultOpenTimeout
        {
            get { throw new NotImplementedException(); }
        }

        protected override void OnAbort()
        {
            throw new NotImplementedException();
        }

        protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            throw new NotImplementedException();
        }

        protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
        {
            throw new NotImplementedException();
        }

        protected override void OnClose(TimeSpan timeout)
        {
            throw new NotImplementedException();
        }

        protected override void OnEndClose(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        protected override void OnEndOpen(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        protected override void OnOpen(TimeSpan timeout)
        {
            throw new NotImplementedException();
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.