Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit c5689fb

Browse files
committed
Revert "State api deprecation: Update samples to default to InMemoryStore and… (#3791)"
This reverts commit dd0c2af.
1 parent dd0c2af commit c5689fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+256
-1368
lines changed

CSharp/Samples/AlarmBot/Global.asax.cs

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
using System.Web.Http;
44
using Autofac;
55
using Autofac.Integration.WebApi;
6-
using Microsoft.Bot.Builder.Azure;
7-
using Microsoft.Bot.Builder.Dialogs;
86
using Microsoft.Bot.Builder.Dialogs.Internals;
9-
using Microsoft.Bot.Connector;
107
using Microsoft.Bot.Sample.AlarmBot.Models;
118

129
namespace Microsoft.Bot.Sample.AlarmBot
@@ -15,47 +12,52 @@ public class Global : System.Web.HttpApplication
1512
{
1613
protected void Application_Start(object sender, EventArgs e)
1714
{
18-
var config = GlobalConfiguration.Configuration;
15+
{
16+
// http://docs.autofac.org/en/latest/integration/webapi.html#quick-start
17+
var builder = new ContainerBuilder();
18+
19+
// register the Bot Builder module
20+
builder.RegisterModule(new DialogModule());
21+
// register the alarm dependencies
22+
builder.RegisterModule(new AlarmModule());
23+
24+
// Get your HttpConfiguration.
25+
var config = GlobalConfiguration.Configuration;
1926

20-
Conversation.UpdateContainer(
21-
builder =>
22-
{
23-
// Register the Bot Builder module
24-
builder.RegisterModule(new DialogModule());
25-
// Register the alarm dependencies
26-
builder.RegisterModule(new AlarmModule());
27+
// Register your Web API controllers.
28+
builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
2729

28-
builder.RegisterModule(new AzureModule(Assembly.GetExecutingAssembly()));
30+
// OPTIONAL: Register the Autofac filter provider.
31+
builder.RegisterWebApiFilterProvider(config);
2932

30-
// Bot Storage: Here we register the state storage for your bot.
31-
// Default store: volatile in-memory store - Only for prototyping!
32-
// We provide adapters for Azure Table, CosmosDb, SQL Azure, or you can implement your own!
33-
// For samples and documentation, see: https://github.com/Microsoft/BotBuilder-Azure
34-
var store = new InMemoryDataStore();
33+
// Bot Storage: This is a great spot to register the private state storage for your bot.
34+
// We provide adapters for Azure Table, CosmosDb, SQL Azure, or you can implement your own!
35+
// For samples and documentation, see: https://github.com/Microsoft/BotBuilder-Azure
3536

36-
// Other storage options
37-
// var store = new TableBotDataStore("...DataStorageConnectionString..."); // requires Microsoft.BotBuilder.Azure Nuget package
38-
// var store = new DocumentDbBotDataStore("cosmos db uri", "cosmos db key"); // requires Microsoft.BotBuilder.Azure Nuget package
37+
// Uncomment the block below to register the private state storage for your bot
38+
// builder.RegisterModule(new AzureModule(Assembly.GetExecutingAssembly()));
3939

40-
builder.Register(c => store)
41-
.Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
42-
.AsSelf()
43-
.SingleInstance();
40+
//// Uncomment one of the lines below to choose your store
41+
//// var store = new TableBotDataStore("...DataStorageConnectionString..."); // requires Microsoft.BotBuilder.Azure Nuget package
42+
//// var store = new DocumentDbBotDataStore("cosmos db uri", "cosmos db key"); // requires Microsoft.BotBuilder.Azure Nuget package
43+
//// var store = new InMemoryDataStore(); // volatile in-memory store
4444

45-
// Register your Web API controllers.
46-
builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
47-
builder.RegisterWebApiFilterProvider(config);
48-
});
45+
//builder.Register(c => store)
46+
// .Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
47+
// .AsSelf()
48+
// .SingleInstance();
4949

50-
// Set the dependency resolver to be Autofac.
51-
config.DependencyResolver = new AutofacWebApiDependencyResolver(Conversation.Container);
50+
// Set the dependency resolver to be Autofac.
51+
var container = builder.Build();
52+
config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
53+
}
5254

5355
// WebApiConfig stuff
54-
GlobalConfiguration.Configure(cfg =>
56+
GlobalConfiguration.Configure(config =>
5557
{
56-
cfg.MapHttpAttributeRoutes();
58+
config.MapHttpAttributeRoutes();
5759

58-
cfg.Routes.MapHttpRoute(
60+
config.Routes.MapHttpRoute(
5961
name: "DefaultApi",
6062
routeTemplate: "api/{controller}/{id}",
6163
defaults: new { id = RouteParameter.Optional }

CSharp/Samples/AlarmBot/Microsoft.Bot.Sample.AlarmBot.csproj

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
44
<Import Project="..\..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" />
@@ -101,83 +101,20 @@
101101
<HintPath>..\..\packages\Autofac.WebApi2.3.4.0\lib\net45\Autofac.Integration.WebApi.dll</HintPath>
102102
<Private>True</Private>
103103
</Reference>
104-
<Reference Include="Chronic, Version=0.3.2.0, Culture=neutral, PublicKeyToken=3bd1f1ef638b0d3c, processorArchitecture=MSIL">
105-
<HintPath>..\..\packages\Chronic.Signed.0.3.2\lib\net40\Chronic.dll</HintPath>
106-
</Reference>
107-
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
108-
<HintPath>..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
109-
</Reference>
110-
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
111-
<HintPath>..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
112-
</Reference>
113-
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
114-
<HintPath>..\..\packages\Microsoft.Azure.DocumentDB.1.11.0\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
115-
</Reference>
116-
<Reference Include="Microsoft.Azure.KeyVault.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
117-
<HintPath>..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
118-
</Reference>
119-
<Reference Include="Microsoft.Bot.Builder, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
120-
<HintPath>..\..\packages\Microsoft.Bot.Builder.3.11.0\lib\net46\Microsoft.Bot.Builder.dll</HintPath>
121-
</Reference>
122-
<Reference Include="Microsoft.Bot.Builder.Autofac, Version=3.10.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
123-
<HintPath>..\..\packages\Microsoft.Bot.Builder.3.11.0\lib\net46\Microsoft.Bot.Builder.Autofac.dll</HintPath>
124-
</Reference>
125-
<Reference Include="Microsoft.Bot.Builder.Azure, Version=3.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
126-
<HintPath>..\..\packages\Microsoft.Bot.Builder.Azure.3.2.4\lib\net46\Microsoft.Bot.Builder.Azure.dll</HintPath>
127-
</Reference>
128-
<Reference Include="Microsoft.Bot.Builder.History, Version=3.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
129-
<HintPath>..\..\packages\Microsoft.Bot.Builder.History.3.0.6\lib\net46\Microsoft.Bot.Builder.History.dll</HintPath>
130-
</Reference>
131-
<Reference Include="Microsoft.Bot.Connector, Version=3.11.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
132-
<HintPath>..\..\packages\Microsoft.Bot.Connector.3.11.1\lib\net45\Microsoft.Bot.Connector.dll</HintPath>
133-
</Reference>
134104
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
135105
<HintPath>..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
136106
<Private>True</Private>
137107
</Reference>
138-
<Reference Include="Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
139-
<HintPath>..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll</HintPath>
140-
<Private>True</Private>
141-
</Reference>
142-
<Reference Include="Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
143-
<HintPath>..\..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll</HintPath>
144-
<Private>True</Private>
145-
</Reference>
146-
<Reference Include="Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
147-
<HintPath>..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
148-
<Private>True</Private>
149-
</Reference>
150-
<Reference Include="Microsoft.IdentityModel.Protocol.Extensions, Version=1.0.40306.1554, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
151-
<HintPath>..\..\packages\Microsoft.IdentityModel.Protocol.Extensions.1.0.4.403061554\lib\net45\Microsoft.IdentityModel.Protocol.Extensions.dll</HintPath>
152-
</Reference>
153-
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
154-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.2\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
155-
</Reference>
156-
<Reference Include="Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
157-
<HintPath>..\..\packages\WindowsAzure.Storage.7.2.1\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
158-
</Reference>
159108
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
160109
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
161110
</Reference>
162111
<Reference Include="System" />
163-
<Reference Include="System.ComponentModel.DataAnnotations" />
164-
<Reference Include="System.Data" />
165-
<Reference Include="System.IdentityModel.Tokens.Jwt, Version=4.0.40306.1554, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
166-
<HintPath>..\..\packages\System.IdentityModel.Tokens.Jwt.4.0.4.403061554\lib\net45\System.IdentityModel.Tokens.Jwt.dll</HintPath>
167-
</Reference>
168-
<Reference Include="System.Net" />
169112
<Reference Include="System.Data.DataSetExtensions" />
170113
<Reference Include="System.Net.Http" />
171114
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
172115
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
173116
<Private>True</Private>
174117
</Reference>
175-
<Reference Include="System.Net.Http.WebRequest" />
176-
<Reference Include="System.Runtime.Serialization" />
177-
<Reference Include="System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
178-
<HintPath>..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll</HintPath>
179-
<Private>True</Private>
180-
</Reference>
181118
<Reference Include="System.Web" />
182119
<Reference Include="System.Web.ApplicationServices" />
183120
<Reference Include="System.Web.DynamicData" />
@@ -191,7 +128,6 @@
191128
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
192129
<Private>True</Private>
193130
</Reference>
194-
<Reference Include="System.Xml" />
195131
<Reference Include="System.Xml.Linq" />
196132
</ItemGroup>
197133
<PropertyGroup>
@@ -225,9 +161,7 @@
225161
</PropertyGroup>
226162
<Error Condition="!Exists('..\..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
227163
<Error Condition="!Exists('..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
228-
<Error Condition="!Exists('..\..\packages\Microsoft.Azure.DocumentDB.1.11.0\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Azure.DocumentDB.1.11.0\build\Microsoft.Azure.DocumentDB.targets'))" />
229164
</Target>
230-
<Import Project="..\..\packages\Microsoft.Azure.DocumentDB.1.11.0\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\..\packages\Microsoft.Azure.DocumentDB.1.11.0\build\Microsoft.Azure.DocumentDB.targets')" />
231165
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
232166
Other similar extension points exist, see Microsoft.Common.targets.
233167
<Target Name="BeforeBuild">

CSharp/Samples/AlarmBot/Web.config

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
http://go.microsoft.com/fwlink/?LinkId=169433
55
-->
66
<configuration>
7-
<configSections>
8-
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
9-
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
10-
</configSections>
117
<!--
128
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
139
@@ -34,14 +30,6 @@
3430
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
3531
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
3632
</dependentAssembly>
37-
<dependentAssembly>
38-
<assemblyIdentity name="Microsoft.Bot.Connector" publicKeyToken="31bf3856ad364e35" culture="neutral" />
39-
<bindingRedirect oldVersion="0.0.0.0-3.11.1.0" newVersion="3.11.1.0" />
40-
</dependentAssembly>
41-
<dependentAssembly>
42-
<assemblyIdentity name="Microsoft.Bot.Builder" publicKeyToken="31bf3856ad364e35" culture="neutral" />
43-
<bindingRedirect oldVersion="0.0.0.0-3.11.0.0" newVersion="3.11.0.0" />
44-
</dependentAssembly>
4533
</assemblyBinding>
4634
</runtime>
4735
<system.codedom>
@@ -58,14 +46,4 @@
5846
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
5947
</handlers>
6048
</system.webServer>
61-
<entityFramework>
62-
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
63-
<parameters>
64-
<parameter value="mssqllocaldb" />
65-
</parameters>
66-
</defaultConnectionFactory>
67-
<providers>
68-
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
69-
</providers>
70-
</entityFramework>
7149
</configuration>

CSharp/Samples/AlarmBot/packages.config

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,10 @@
22
<packages>
33
<package id="Autofac" version="3.5.2" targetFramework="net46" />
44
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net46" />
5-
<package id="Chronic.Signed" version="0.3.2" targetFramework="net46" />
6-
<package id="EntityFramework" version="6.1.3" targetFramework="net46" />
75
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net46" />
86
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net46" />
97
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net46" />
10-
<package id="Microsoft.Azure.DocumentDB" version="1.11.0" targetFramework="net46" />
11-
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net46" />
12-
<package id="Microsoft.Bot.Builder" version="3.11.0" targetFramework="net46" />
13-
<package id="Microsoft.Bot.Builder.Azure" version="3.2.4" targetFramework="net46" />
14-
<package id="Microsoft.Bot.Builder.History" version="3.0.6" targetFramework="net46" />
15-
<package id="Microsoft.Bot.Connector" version="3.11.1" targetFramework="net46" />
168
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.1" targetFramework="net46" />
17-
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net46" />
18-
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net46" />
19-
<package id="Microsoft.Data.Services.Client" version="5.6.4" targetFramework="net46" />
20-
<package id="Microsoft.IdentityModel.Protocol.Extensions" version="1.0.4.403061554" targetFramework="net46" />
219
<package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net46" developmentDependency="true" />
22-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.2" targetFramework="net46" />
2310
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
24-
<package id="System.IdentityModel.Tokens.Jwt" version="4.0.4.403061554" targetFramework="net46" />
25-
<package id="System.Spatial" version="5.6.4" targetFramework="net46" />
26-
<package id="WindowsAzure.Storage" version="7.2.1" targetFramework="net46" />
2711
</packages>

0 commit comments

Comments
 (0)