query from InMemory database in .net core unit testing









up vote
0
down vote

favorite












i am using UseInMemoryDatabase() function in below code statement:



var options = new DbContextOptionsBuilder<CRUDContext>()
.UseInMemoryDatabase(databaseName: "DBTest1")
.Options;

// Run the test against one instance of the context
using (var context = new CRUDContext(options))


now i want to query on "DBTest1" from SQL Server Object Explorer in VS or query on "DBTest1" from Microsoft SQL Server Management Studio.



how can i do that?



thanks guys.










share|improve this question





















  • Sounds like you’ve misunderstood what this is for, you won’t use it in SSMS, see this link
    – Matt
    Nov 10 at 11:06










  • thank you dear Matt. I used that in unit testing. i want just access to DBTest and querying on it in debugging mode when created OTA. what you mean? can you explain more?
    – Hamid Nasirloo
    Nov 10 at 11:42











  • If you want to look at data whilst debugging tests you can use your context pretty much as you would when debugging your actual application code. But what I meant was that this in memory database is really just for testing so the best way to use it is to just assert what you expect to see in it add the end of each test. By the way I just realised I put the wrong link in my first comment! Here’s the correct link
    – Matt
    Nov 10 at 12:35











  • thank you dear matt. i saw that link before. however our need is to query from OTA created database in SQL Server Object Explorer or in Microsoft SQL Server Management Studio.
    – Hamid Nasirloo
    Nov 10 at 13:04










  • No problem, this is only meant to be used for testing so I don’t think it’s possible to access it via SSMS.
    – Matt
    Nov 10 at 14:46














up vote
0
down vote

favorite












i am using UseInMemoryDatabase() function in below code statement:



var options = new DbContextOptionsBuilder<CRUDContext>()
.UseInMemoryDatabase(databaseName: "DBTest1")
.Options;

// Run the test against one instance of the context
using (var context = new CRUDContext(options))


now i want to query on "DBTest1" from SQL Server Object Explorer in VS or query on "DBTest1" from Microsoft SQL Server Management Studio.



how can i do that?



thanks guys.










share|improve this question





















  • Sounds like you’ve misunderstood what this is for, you won’t use it in SSMS, see this link
    – Matt
    Nov 10 at 11:06










  • thank you dear Matt. I used that in unit testing. i want just access to DBTest and querying on it in debugging mode when created OTA. what you mean? can you explain more?
    – Hamid Nasirloo
    Nov 10 at 11:42











  • If you want to look at data whilst debugging tests you can use your context pretty much as you would when debugging your actual application code. But what I meant was that this in memory database is really just for testing so the best way to use it is to just assert what you expect to see in it add the end of each test. By the way I just realised I put the wrong link in my first comment! Here’s the correct link
    – Matt
    Nov 10 at 12:35











  • thank you dear matt. i saw that link before. however our need is to query from OTA created database in SQL Server Object Explorer or in Microsoft SQL Server Management Studio.
    – Hamid Nasirloo
    Nov 10 at 13:04










  • No problem, this is only meant to be used for testing so I don’t think it’s possible to access it via SSMS.
    – Matt
    Nov 10 at 14:46












up vote
0
down vote

favorite









up vote
0
down vote

favorite











i am using UseInMemoryDatabase() function in below code statement:



var options = new DbContextOptionsBuilder<CRUDContext>()
.UseInMemoryDatabase(databaseName: "DBTest1")
.Options;

// Run the test against one instance of the context
using (var context = new CRUDContext(options))


now i want to query on "DBTest1" from SQL Server Object Explorer in VS or query on "DBTest1" from Microsoft SQL Server Management Studio.



how can i do that?



thanks guys.










share|improve this question













i am using UseInMemoryDatabase() function in below code statement:



var options = new DbContextOptionsBuilder<CRUDContext>()
.UseInMemoryDatabase(databaseName: "DBTest1")
.Options;

// Run the test against one instance of the context
using (var context = new CRUDContext(options))


now i want to query on "DBTest1" from SQL Server Object Explorer in VS or query on "DBTest1" from Microsoft SQL Server Management Studio.



how can i do that?



thanks guys.







unit-testing asp.net-core .net-core in-memory-database






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 10 at 10:22









Hamid Nasirloo

313




313











  • Sounds like you’ve misunderstood what this is for, you won’t use it in SSMS, see this link
    – Matt
    Nov 10 at 11:06










  • thank you dear Matt. I used that in unit testing. i want just access to DBTest and querying on it in debugging mode when created OTA. what you mean? can you explain more?
    – Hamid Nasirloo
    Nov 10 at 11:42











  • If you want to look at data whilst debugging tests you can use your context pretty much as you would when debugging your actual application code. But what I meant was that this in memory database is really just for testing so the best way to use it is to just assert what you expect to see in it add the end of each test. By the way I just realised I put the wrong link in my first comment! Here’s the correct link
    – Matt
    Nov 10 at 12:35











  • thank you dear matt. i saw that link before. however our need is to query from OTA created database in SQL Server Object Explorer or in Microsoft SQL Server Management Studio.
    – Hamid Nasirloo
    Nov 10 at 13:04










  • No problem, this is only meant to be used for testing so I don’t think it’s possible to access it via SSMS.
    – Matt
    Nov 10 at 14:46
















  • Sounds like you’ve misunderstood what this is for, you won’t use it in SSMS, see this link
    – Matt
    Nov 10 at 11:06










  • thank you dear Matt. I used that in unit testing. i want just access to DBTest and querying on it in debugging mode when created OTA. what you mean? can you explain more?
    – Hamid Nasirloo
    Nov 10 at 11:42











  • If you want to look at data whilst debugging tests you can use your context pretty much as you would when debugging your actual application code. But what I meant was that this in memory database is really just for testing so the best way to use it is to just assert what you expect to see in it add the end of each test. By the way I just realised I put the wrong link in my first comment! Here’s the correct link
    – Matt
    Nov 10 at 12:35











  • thank you dear matt. i saw that link before. however our need is to query from OTA created database in SQL Server Object Explorer or in Microsoft SQL Server Management Studio.
    – Hamid Nasirloo
    Nov 10 at 13:04










  • No problem, this is only meant to be used for testing so I don’t think it’s possible to access it via SSMS.
    – Matt
    Nov 10 at 14:46















Sounds like you’ve misunderstood what this is for, you won’t use it in SSMS, see this link
– Matt
Nov 10 at 11:06




Sounds like you’ve misunderstood what this is for, you won’t use it in SSMS, see this link
– Matt
Nov 10 at 11:06












thank you dear Matt. I used that in unit testing. i want just access to DBTest and querying on it in debugging mode when created OTA. what you mean? can you explain more?
– Hamid Nasirloo
Nov 10 at 11:42





thank you dear Matt. I used that in unit testing. i want just access to DBTest and querying on it in debugging mode when created OTA. what you mean? can you explain more?
– Hamid Nasirloo
Nov 10 at 11:42













If you want to look at data whilst debugging tests you can use your context pretty much as you would when debugging your actual application code. But what I meant was that this in memory database is really just for testing so the best way to use it is to just assert what you expect to see in it add the end of each test. By the way I just realised I put the wrong link in my first comment! Here’s the correct link
– Matt
Nov 10 at 12:35





If you want to look at data whilst debugging tests you can use your context pretty much as you would when debugging your actual application code. But what I meant was that this in memory database is really just for testing so the best way to use it is to just assert what you expect to see in it add the end of each test. By the way I just realised I put the wrong link in my first comment! Here’s the correct link
– Matt
Nov 10 at 12:35













thank you dear matt. i saw that link before. however our need is to query from OTA created database in SQL Server Object Explorer or in Microsoft SQL Server Management Studio.
– Hamid Nasirloo
Nov 10 at 13:04




thank you dear matt. i saw that link before. however our need is to query from OTA created database in SQL Server Object Explorer or in Microsoft SQL Server Management Studio.
– Hamid Nasirloo
Nov 10 at 13:04












No problem, this is only meant to be used for testing so I don’t think it’s possible to access it via SSMS.
– Matt
Nov 10 at 14:46




No problem, this is only meant to be used for testing so I don’t think it’s possible to access it via SSMS.
– Matt
Nov 10 at 14:46

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237991%2fquery-from-inmemory-database-in-net-core-unit-testing%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237991%2fquery-from-inmemory-database-in-net-core-unit-testing%23new-answer', 'question_page');

);

Post as a guest














































































Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

Evgeni Malkin