protected AbstractConversationInterceptor(IConversationalMetaInfoStore metadataStore,
			IConversationsContainerAccessor conversationsContainerAccessor,
			IConversationFactory conversationFactory)
		{
			ConversationsContainerAccessor = conversationsContainerAccessor;
			ConversationFactory = conversationFactory;
			MetadataStore = metadataStore;
		}
Esempio n. 2
0
 public ConversationInterceptor(IKernel kernel,
                                IConversationalMetaInfoStore metadataStore,
                                IConversationsContainerAccessor conversationsContainerAccessor,
                                IConversationFactory conversationFactory)
     : base(metadataStore, conversationsContainerAccessor, conversationFactory)
 {
     this.kernel = kernel;
 }
Esempio n. 3
0
 protected AbstractConversationInterceptor(IConversationalMetaInfoStore metadataStore,
                                           IConversationsContainerAccessor conversationsContainerAccessor,
                                           IConversationFactory conversationFactory)
 {
     ConversationsContainerAccessor = conversationsContainerAccessor;
     ConversationFactory            = conversationFactory;
     MetadataStore = metadataStore;
 }
Esempio n. 4
0
        public void CreateCoversationStuff()
        {
            TestFixtureSetUp();
            var provider = new SessionFactoryProviderStub(sessions);

            cf  = new DefaultConversationFactory(provider, new FakeSessionWrapper());
            cca = new NhConversationsContainerAccessor(provider);
        }
Esempio n. 5
0
		public ConversationInterceptor(IKernel kernel,
			IConversationalMetaInfoStore metadataStore,
			IConversationsContainerAccessor conversationsContainerAccessor,
			IConversationFactory conversationFactory)
			: base(metadataStore, conversationsContainerAccessor, conversationFactory)
		{
			this.kernel = kernel;
		}
 public ExampleInteractor(
     IConversationRepository conversationRepository, 
     IConversationFactory conversationFactory,
     IRequestMapper requestMapper)
 {
     _conversationRepository = conversationRepository;
     _conversationFactory = conversationFactory;
     _requestMapper = requestMapper;
 }
 public SendMessageViewModel(IUserService userService,
                             IConversationService conversationService,
                             IConversationFactory conversationFactory,
                             IFrameNavigationService frameNavigationService) : base(frameNavigationService)
 {
     _userService         = userService;
     _conversationService = conversationService;
     _conversationFactory = conversationFactory;
 }
 public ConversationContext(
     IMicrosoftCognitiveServicesApiKeys apiKeys,
     IConversationFactory conversationFactory,
     IConversationHistory conversationHistory,
     IIntentProvider intentProvider)
 {
     ApiKeys             = apiKeys;
     ConversationFactory = conversationFactory;
     ConversationHistory = conversationHistory;
     IntentProvider      = intentProvider;
 }
Esempio n. 9
0
 protected PersistenceConversationalModel(IConversationsContainerAccessor cca, IConversationFactory cf)
 {
     if (cca == null)
     {
         throw new ArgumentNullException("cca");
     }
     if (cf == null)
     {
         throw new ArgumentNullException("cf");
     }
     this.cca = cca;
     this.cf  = cf;
 }
Esempio n. 10
0
        public ConversationService(
            IEFRepository <Conversation> conversationRepository,
            IUnitOfWork unitOfWork,
            IConversationFactory conversationFactory,
            IMessageService messageService)
        {
            Guard.WhenArgument(conversationRepository, "ConversationRepository").IsNull().Throw();
            Guard.WhenArgument(unitOfWork, "UnitOfWork").IsNull().Throw();
            Guard.WhenArgument(conversationFactory, "ConversationFactory").IsNull().Throw();
            Guard.WhenArgument(messageService, "MessageService").IsNull().Throw();

            this.conversationRepository = conversationRepository;
            this.unitOfWork             = unitOfWork;
            this.conversationFactory    = conversationFactory;
            this.messageService         = messageService;
        }
        public ConversationService(
            IIntentProvider intentProvider,
            ILuisService luisService,
            IOleSettings oleSettings,
            IConversationHistory convoHistory,
            IConversationFactory convoFactory,
            IConversationResponseFactory responseFactory,
            ITextAnalyticsService textAnalyticsService)
        {
            IntentProvider              = intentProvider;
            LuisService                 = luisService;
            OleSettings                 = oleSettings;
            ConversationHistory         = convoHistory;
            ConversationFactory         = convoFactory;
            ConversationResponseFactory = responseFactory;
            TextAnalyticsService        = textAnalyticsService;

            AppId = OleSettings.OleApplicationId;
        }
Esempio n. 12
0
        public void OnEntry(MethodExecutionArgs eventArgs)
        {
            if (IsNoopConversationalMarkerActive)
            {
                return;
            }

            var           convId = GetConversationIdMethod.Invoke();
            IConversation c      = ConversationsContainerAccessor.Container.Get(convId);

            if (c == null)
            {
                IConversationFactory cf = ConversationFactory;
                if (cf == null)
                {
                    return;
                }
                c = cf.CreateConversation(convId);
                // we are using the event because a custom eventHandler can prevent the rethrow
                // but we must Unbind the conversation from the container
                // and we must dispose the conversation itself (high probability UoW inconsistence).
                c.OnException += ((conversation, args) => ConversationsContainerAccessor.Container.Unbind(c.Id).Dispose());
                ConfigureConversation(c, eventArgs.Instance);
                ConversationsContainerAccessor.Container.SetAsCurrent(c);
                c.Start();
                ConversationPausedWatcher.Watch(c);
            }
            else
            {
                ConversationsContainerAccessor.Container.SetAsCurrent(c);
                if (ConversationPausedWatcher.IsPaused(c))
                {
                    c.Resume();
                }
                else
                {
                    eventArgs.MethodExecutionTag = NestedMethodMarker;
                }
            }
        }
Esempio n. 13
0
 public FamilyCrudModel(IConversationsContainerAccessor cca, IConversationFactory cf, IDaoFactory factory)
     : base(cca, cf)
 {
     animalDao = factory.GetDao <IAnimalReadOnlyDao <TAnimal> >();
     familyDao = factory.GetDao <IFamilyDao <TAnimal> >();
 }
        /// <summary>
        /// Factory-method for different persistences.
        /// </summary>
        /// <param name="type">Type of persistence to create.</param>
        /// <param name="schemaUpdate">Indicates if schema is updated ('true') or recreated from scratch ('false').</param>
        /// <param name="persistenceService">Reference to persistence service.</param>
        /// <param name="transactionService">Reference to transaction service.</param>
        /// /// <param name="conversationFactory">Reference to conversation factory for creating conversations.</param>
        public static void CreatePersistenceService(
            PersistenceServiceType type, 
            bool schemaUpdate, 
            out IPersistenceServices persistenceService, 
            out ITransactionServices transactionService,
            out IConversationFactory conversationFactory)
        {
            Configuration configuration = new Configuration();
            FluentConfiguration fluentConfiguration = Fluently.Configure(configuration);

            // fetch connection string from configuration file
            System.Configuration.ConnectionStringSettings connectionSettings = System.Configuration.ConfigurationManager.ConnectionStrings["DatabaseConnection"];
            Contract.Assert(connectionSettings != null, "A database connection setting needs to be defined in the App.config."); 
            string connectionString = connectionSettings.ConnectionString;
            Contract.Assert(connectionString != null, "A database connection string needs to be defined in the App.config."); 

            // set persistencetype
            switch (type)
            {
                case PersistenceServiceType.MSSQL2008:
                    fluentConfiguration = fluentConfiguration.Database(
                        MsSqlConfiguration.MsSql2008.ConnectionString(connectionString));
                    break;
                case PersistenceServiceType.MySQL:
                    fluentConfiguration = fluentConfiguration.Database(
                        MySQLConfiguration.Standard.ConnectionString(connectionString));
                    break; 
            }

            // get all user assemblies
            ICollection<Assembly> allAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where(assembly => 
                         assembly.ManifestModule.Name != "<In Memory Module>"
                     && !assembly.FullName.StartsWith("mscorlib") 
                     && !assembly.FullName.StartsWith("System")
                     && !assembly.FullName.StartsWith("Microsoft")).ToList();
            foreach (Assembly mappingAssembly in allAssemblies)
            {
                // find all types that derive from ClassMap<>
                IList<Type> types = mappingAssembly.GetTypes().Where(t =>
                       t != typeof(AutoMapping<>)
                    && t.BaseType != null
                    && t.BaseType.IsGenericType
                    && t.BaseType.GetGenericTypeDefinition() == typeof(ClassMap<>)).ToList();

                // if there are any, we add their assembly
                if (types.Count > 0)
                {
                    fluentConfiguration = fluentConfiguration.Mappings(m => m.FluentMappings.AddFromAssembly(mappingAssembly));
                }
            }

            try
            {
                configuration = fluentConfiguration
                    .ExposeConfiguration(cfg =>
                        {
                            if (schemaUpdate)
                            {
                                new SchemaUpdate(cfg)
                                    .Execute(false, true);
                            }
                            else
                            {
                                new SchemaExport(cfg)
                                    .Create(false, true);
                            }
                        })
                    .BuildConfiguration();
            }
            catch (FluentConfigurationException fluentEx)
            {
                if (fluentEx.InnerException != null)
                {
                    if (fluentEx.InnerException is HibernateException)
                    {
                        if (fluentEx.InnerException.Message.Contains("Table") && fluentEx.InnerException.Message.Contains("already exists"))
                        {
                            TechnicalProblemException tpEx = new TechnicalProblemException("Error building FluentNHibernate configuration. Try dropping and re-creating database schema.", fluentEx);
                            Log.Fatal(tpEx.ToString());
                            throw tpEx;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TechnicalProblemException tpEx = new TechnicalProblemException("Error building FluentNHibernate configuration.", ex);
                Log.Fatal(tpEx.ToString());
                throw tpEx;
            }
            NHibernatePersistenceServices nhPersistenceService = new NHibernatePersistenceServices(configuration);
            persistenceService = nhPersistenceService as IPersistenceServices;
            transactionService = nhPersistenceService as ITransactionServices;
            conversationFactory = persistenceService as IConversationFactory;
        }
Esempio n. 15
0
 public ConversationInterceptor(IConversationalMetaInfoStore metadataStore,
                                IConversationsContainerAccessor conversationsContainerAccessor,
                                IConversationFactory conversationFactory)
     : base(metadataStore, conversationsContainerAccessor, conversationFactory)
 {
 }