{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/8115","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/8115/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/8115/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/8115/events","html_url":"https://github.com/aspnet/EntityFramework/issues/8115","id":220711437,"number":8115,"title":"Cannot create database when using MemoryOptimizedTables","user":{"login":"andrelmp","id":3950193,"avatar_url":"https://avatars0.githubusercontent.com/u/3950193?v=3","gravatar_id":"","url":"https://api.github.com/users/andrelmp","html_url":"https://github.com/andrelmp","followers_url":"https://api.github.com/users/andrelmp/followers","following_url":"https://api.github.com/users/andrelmp/following{/other_user}","gists_url":"https://api.github.com/users/andrelmp/gists{/gist_id}","starred_url":"https://api.github.com/users/andrelmp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrelmp/subscriptions","organizations_url":"https://api.github.com/users/andrelmp/orgs","repos_url":"https://api.github.com/users/andrelmp/repos","events_url":"https://api.github.com/users/andrelmp/events{/privacy}","received_events_url":"https://api.github.com/users/andrelmp/received_events","type":"User","site_admin":false},"labels":[{"id":333904587,"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/type-investigation","name":"type-investigation","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":{"login":"divega","id":1253414,"avatar_url":"https://avatars3.githubusercontent.com/u/1253414?v=3","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false},"assignees":[{"login":"divega","id":1253414,"avatar_url":"https://avatars3.githubusercontent.com/u/1253414?v=3","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/24","html_url":"https://github.com/aspnet/EntityFramework/milestone/24","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/24/labels","id":2044943,"number":24,"title":"2.0.0","description":"","creator":{"login":"rowanmiller","id":4741851,"avatar_url":"https://avatars1.githubusercontent.com/u/4741851?v=3","gravatar_id":"","url":"https://api.github.com/users/rowanmiller","html_url":"https://github.com/rowanmiller","followers_url":"https://api.github.com/users/rowanmiller/followers","following_url":"https://api.github.com/users/rowanmiller/following{/other_user}","gists_url":"https://api.github.com/users/rowanmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/rowanmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rowanmiller/subscriptions","organizations_url":"https://api.github.com/users/rowanmiller/orgs","repos_url":"https://api.github.com/users/rowanmiller/repos","events_url":"https://api.github.com/users/rowanmiller/events{/privacy}","received_events_url":"https://api.github.com/users/rowanmiller/received_events","type":"User","site_admin":false},"open_issues":250,"closed_issues":206,"state":"open","created_at":"2016-10-03T18:11:14Z","updated_at":"2017-04-12T19:07:01Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2017-04-10T17:13:58Z","updated_at":"2017-04-12T19:38:30Z","closed_at":null,"body":"I have a entity configured to use MemoryOptimizedTabled as follow:\r\n```c#\r\n            builder.Entity<ApplicationUser>()\r\n                   .ToTable(\"Users\")\r\n                   .ForSqlServerIsMemoryOptimized(true);\r\n```\r\nWhen the application starts i run the following command to apply migrations to database:\r\n```c#\r\napp.ApplicationServices.GetRequiredService<ApplicationDbContext>()\r\n                                      .Database.Migrate();\r\n```\r\nIf database already exists on server without any table or data everything works fine, but if not exists the exception above is thown.\r\n\r\nIt seems that when I create the database using Sql Manager, the AUTO_CLOSE option is false, but when the Entity Framework creates this option it is true by default\r\n\r\n```\r\nSystem.Data.SqlClient.SqlException occurred\r\n  HResult=0x80131904\r\n  Message=The operation 'AUTO_CLOSE' is not supported with databases that have a MEMORY_OPTIMIZED_DATA filegroup.\r\n  Source=Core .Net SqlClient Data Provider\r\n  StackTrace:\r\n   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)\r\n   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)\r\n   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, String executeMethod, IReadOnlyDictionary`2 parameterValues, Boolean closeConnection)\r\n   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)\r\n   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)\r\n   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)\r\n   at WebApplication4.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in c:\\users\\andrepassos\\documents\\visual studio 2017\\Projects\\WebApplication4\\Startup.cs:line 87\r\n```\r\n\r\n\r\n\r\n\r\n### Further technical details\r\nEF Core version: 1.1.1\r\nDatabase Provider: Microsoft.EntityFrameworkCore.SqlServer\r\nOperating system: Windows 10 x64 Pro\r\nIDE: Visual Studio 2017\r\nDatabase Engine: Sql Server 2016 Developer, Sql Server 2016 Express SP1\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/293685121","html_url":"https://github.com/aspnet/EntityFramework/issues/8115#issuecomment-293685121","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/8115","id":293685121,"user":{"login":"ajcvickers","id":1430078,"avatar_url":"https://avatars2.githubusercontent.com/u/1430078?v=3","gravatar_id":"","url":"https://api.github.com/users/ajcvickers","html_url":"https://github.com/ajcvickers","followers_url":"https://api.github.com/users/ajcvickers/followers","following_url":"https://api.github.com/users/ajcvickers/following{/other_user}","gists_url":"https://api.github.com/users/ajcvickers/gists{/gist_id}","starred_url":"https://api.github.com/users/ajcvickers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajcvickers/subscriptions","organizations_url":"https://api.github.com/users/ajcvickers/orgs","repos_url":"https://api.github.com/users/ajcvickers/repos","events_url":"https://api.github.com/users/ajcvickers/events{/privacy}","received_events_url":"https://api.github.com/users/ajcvickers/received_events","type":"User","site_admin":false},"created_at":"2017-04-12T19:38:30Z","updated_at":"2017-04-12T19:38:30Z","body":"@divega Maybe the statement, \"but when the Entity Framework creates this option it is true by default\" is in error or only happens sometimes?"}}
{"actor":{"display_login":"ajcvickers"}}