World Wide DBA

Mar 11, 2019 09:53
No, what I wanted to do wont work either.
Mar 11, 2019 09:51
One moment, I may have an idea
Mar 11, 2019 09:48
You are correct. Which means that what you want to achieve cannot be done. You must either use a global temporary table or refactor your code to work around the restrictions placed upon you by the system.
Mar 11, 2019 09:43
How so?
Mar 11, 2019 09:42
Hi
Mar 11, 2019 09:42
Thanks, updated my answer for you.
Mar 11, 2019 09:42
What error is it throwing?
Mar 11, 2019 09:42
No, you don't need to declare it beforehand, it'll get created when the statement executes.
 
Feb 13, 2019 20:55
@Paparazzi The deny is applied to any user or role that is not an administrator of that database.
 

 The Heap™ – Consultancy ©®

General on- and off-site discussion for dba.stackexchange.com....
Sep 8, 2018 22:26
Is anybody going to PASS Summit this year? It would be great to finally meet up with some of you!
Mar 11, 2016 04:29
@MaxVernon I saw your post on twitter today about the Data Driven event and Nokia, to be honest when he pulled out the iPhone I thought exactly the same :)
Feb 16, 2016 17:20
@Zane I will be attending but not speaking. I am hoping to speak at the next PASS event in Chicago though, it'll be my first time presenting.
Feb 16, 2016 17:03
Is anybody going to SQL Saturday Chicago?
Feb 16, 2016 17:03
Good Morning All
Feb 4, 2016 16:02
@dezso wow, I guess the guy didn't actually want an answer or an opinion on how he could improve ;)
Feb 4, 2016 14:46
@PaulWhite I'm originally from the UK
 
Mar 26, 2017 05:05
Not a problem - also have a look at this project, it uses identity without EF: code.msdn.microsoft.com/vstudio/…
Mar 26, 2017 05:03
I am trying to find the source code for the identity framework so that I can look at what is happening internally. When I find out I will let you know.
Mar 26, 2017 04:57
I understand your confusion, especially as both fields can actually contain the same value, but they have two different use cases. NormalizedUserName is used solely for Authentication, NormalizedEmail is used solely for password recovery
Mar 26, 2017 04:48
But as I said, that is by design, it is not a defect it is just not functioning how your particular case needs it to - in which case you would need to code around it to meet your particular needs
Mar 26, 2017 04:44
OK, so why can't you just change the validation routine in AccountViewModels?
Mar 26, 2017 04:41
Yes, but the fact that the email is the username is by design and so that is not a defect, the problem is that once you change the username in the db, you cannot log back in with the new username, correct?
Mar 26, 2017 04:39
I will need time to try and reproduce your problem - in essence, you do not want the email to be the normalizedusername, correct?
Mar 26, 2017 04:34
I still feel this is cache related but I want to be sure.
Mar 26, 2017 04:34
What are your test steps?
Mar 26, 2017 04:33
Probably express.
Mar 26, 2017 04:31
Are you using IIS or IIS Express?
Mar 26, 2017 04:30
Once the cache is flushed, EF will then start to load records from the DB into memory again as they are requested.
Mar 26, 2017 04:29
So EF keeps a copy of each record in memory to reduce the amount of times it calls the database. If you update the record in the database EF will not know that the one in memory also needs to be updated unless you flush your cache.
Mar 26, 2017 04:28
If you want it to pick up the new NormalizedUserName you will need to refresh your cache. EF is not smart enough to know when you change a database record, it expects to do it itself
Mar 26, 2017 04:27
Yes it will do that because of what I mentioned earlier about the EF Cache
Mar 26, 2017 04:24
Give me a few minutes
Mar 26, 2017 04:23
Yes
Mar 26, 2017 04:22
can you post the template?
Mar 26, 2017 04:21
Sorry, I was referring to this specific line: "FWIW, we supposedly don’t do this anymore in recent builds of Identity 3.0 (i.e. the version we maintain in this repo). Instead we compute a normalized representation of the user name and we store it in a separate column so that lookups by normalized user name should now be sargable."
Mar 26, 2017 04:18
So the problem you are facing looks like it was implemented deliberately to resolve a previous problem: github.com/aspnet/Identity/issues/351
Mar 26, 2017 04:12
Also, I don't like EF as it does not support all SQL Server functionality - thats not to say I haven't used it, it is fine for basic stuff but when you get complicated EF is just not up to the task
Mar 26, 2017 04:11
I'm looking into the Login issue for you - I do not use it myself as I only write apps for internal company network
Mar 26, 2017 04:10
if you do not define a property as virtual it does not know it is a foreign key unless you then start using the data annotations and/or setting the mappings yourself in the model context
Mar 26, 2017 04:09
In regards to the virtual modifier, it can get complicated, for each class that represents a table, such as Order, EF creates a proxy class called Order_1234 or something similar - this class derives from your own but overrides the virtuals
Mar 26, 2017 04:04
Sorry, I'm just trying to research your problem.
Mar 26, 2017 03:59
So the virtual properties represent foreign keys in the database, this is how EF handles them in code. They are actually overrides later by EF so when you call the property it then loads it from the database or EF cache.
Mar 26, 2017 03:58
OK
Mar 26, 2017 03:57
Have you resolved the issue since posting or do you still require assistance?
Mar 26, 2017 03:57
I just saw your comments on the questions so I decided to invite you to a chat as long conversations are not allowed in the questions themselves
Mar 26, 2017 03:56
Hi Edward
Mar 26, 2017 03:55
From what I can see on this thread: github.com/aspnet/EntityFramework/issues/6818 it is down to a property not being marked as nullable on the model. Also it could be this one github.com/aspnet/EntityFramework/issues/5112 where the root of the problem was an invalid binding on the model.
Mar 26, 2017 03:55
My mistake I missed that. So the problem occurs when it is trying to convert the result set to the list. Two things then, the first, hover over the Order DbSet - that will give you the query being issued, copy it and run it against SQL Server to ensure you get data, second, check that the properties of your model matches the columns of the database in terms of being able to accept nulls.
Mar 26, 2017 03:55
You didn't ad a reference to the SO question so I couldn't see what you previously posted. The stack trace for the exception will point to where the exception is being thrown. Can you post it?
Mar 26, 2017 03:55
Your _context has either not been initialized or your Order table has no records in it. Put a breakpoint on the line that throws an error and hover over _context to see if it is null and check to see if the table has rows.