Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            // Get rid of compiler warnings by using the GenericResolver related variables.
            m_FeedStats          = new DataFeedStatistics();
            m_DataAnalysisResult = new IngestedDataAnalysisResult();

            Console.Title = m_ThisName;
            Console.WriteLine("{0}.Main(): Entered. Awaiting your input to start the", m_ThisName);
            Console.WriteLine("Service Host for the AdminManager and SomeManager");
            ConsoleNTraceHelpers.PauseTillUserPressesEnter();

            ServiceHost <AdminManager> adminHost       = null;
            ServiceHost <SomeManager>  someManagerHost = null;

            try
            {
                adminHost = new ServiceHost <AdminManager>();
                adminHost.Open();
                Console.WriteLine("{0}.Main():  Admin ServiceHost opened OK.", m_ThisName);

                someManagerHost = new ServiceHost <SomeManager>();
                someManagerHost.Open();
                Console.WriteLine("{0}.Main():  SomeManager ServiceHost opened OK.", m_ThisName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0}.Main():  host.Open() Threw exception!\n     {1}", m_ThisName, ex);
            }
            Console.WriteLine("\n{0}.Main():  Press ENTER to EXIT.", m_ThisName);
            Console.ReadLine();
            CloseOrAbortHosts(adminHost, someManagerHost);
            Console.WriteLine("\n{0}.Main(): Exiting......", m_ThisName);
        }
        IngestedDataAnalysisResult ISomeServiceContract.AnalyzeIngestedData()
        {
            // Get the ingested data from the DB.
            ISomeDataAnalysisEngine dataAnalysisEngineProxy =
                InProcFactory.CreateInstance <SomeDataAnalysisEngine, ISomeDataAnalysisEngine>();
            IngestedDataAnalysisResult analysisResult = dataAnalysisEngineProxy.DoIngestedDataAnalysis();

            return(analysisResult);
        }
Ejemplo n.º 3
0
 public IngestedDataAnalysisResult AnalyzeIngestedData()
 {
     // "Programming WCF Services", 3rd Edition by Juval Lowy
     // pp 258 - 259 recommends the form of implementing proxies like below.
     try
     {
         IngestedDataAnalysisResult result = Channel.AnalyzeIngestedData();
         return(result);
     }
     catch (Exception)
     {
         Abort();
         throw;
     }
 }
Ejemplo n.º 4
0
        IngestedDataAnalysisResult ISomeDataAnalysisEngine.DoIngestedDataAnalysis()
        {
            // Get the ingested data from the DB.
            IIngestedDataDA ingestDataDaProxy    = InProcFactory.CreateInstance <IngestedDataDA, IIngestedDataDA>();
            string          dummyDataForAnalysis = ingestDataDaProxy.GetDummyDataForAnalysis();

            // Do the analysis.
            IngestedDataAnalysisResult result = new IngestedDataAnalysisResult();

            InProcFactory.CloseProxy(ingestDataDaProxy);
            result.ResultPart1 = dummyDataForAnalysis;
            int analysisResult = dummyDataForAnalysis.Length;

            result.ResultPart2 =
                string.Format("The analysis of the dummy data reveals it contains {0} characters", analysisResult);
            return(result);
        }
Ejemplo n.º 5
0
        private static void DisplayDataAnalysisResult()
        {
            Console.WriteLine("{0}.Main(): Analyzing ingested data..", m_ThisName);
            IngestedDataAnalysisResult result = AnalyzeIngestedData();
            string analysisMsg;

            if (result != null)
            {
                analysisMsg  = string.Format("{0}.Main():\nData Analysis Result Part 1 =\n  {1}", m_ThisName, result.ResultPart1);
                analysisMsg += string.Format("\nData Analysis Result Part 2 =\n  {0}", result.ResultPart2);
            }
            else
            {
                analysisMsg = "Server return null.";
            }
            Console.WriteLine(analysisMsg);
        }
Ejemplo n.º 6
0
        private static IngestedDataAnalysisResult AnalyzeIngestedData()
        {
            IngestedDataAnalysisResult result = null;
            SomeDataAnalysisClient     proxy  = new SomeDataAnalysisClient("someDataAnalysis");

            try
            {
                result = proxy.AnalyzeIngestedData();
                proxy.Close();
            }
            catch (Exception ex)
            {
                ConsoleNTraceHelpers.DisplayExToConsoleNTrace(m_ThisName + ".AnalyzeIngestedData(): Exception!! ", ex);
                proxy.Abort();
            }
            return(result);
        }