Comments (8)
Forgot to add, I am connecting to SQL Server 2012. Thanks
from permissionaccesscontrol2.
I haven't tested the SQL side for a while so there may well be a problem. I'm on a contract at the moment so I will look at it at the weekend.
from permissionaccesscontrol2.
I tried the following:
- I made sure I didn't have a database called
PermissionAccessControl2-AspNetCoreIdentity
andPermissionAccessControl2-DemoDatabase
so that I was starting from stratch. - I just changed the appsettings to
{
... other parts left out
"DemoSetup": {
"DatabaseSetup": "Permanent",
"UpdateCookieOnChange": true //this doesn't matter.
}
And when I ran the the application it started OK. I then stopped the application and ran it again - it was fine. So I don't see your error.
Can you tell me about your PermissionAccessControl2-DemoDatabase
. Is it old, or have your tried to swap over to migrations (which wouldn't work without changes). If its not that then I don't know what it is.
Let me know.
from permissionaccesscontrol2.
PS. I have been cleaning things up and found there were some changes to the database schema between the first version (Part 3) and the latest (Part 6). Therefore if you ran a early copy of PermissionAccessControl2 your database schema might be out of date to the current version.
from permissionaccesscontrol2.
from permissionaccesscontrol2.
Wow, a long answer. Here are my (short) answers.
I updated the PermissionAccessControl2 software as I created the new articles, so the version in master has everything in it. That was easier to me, but does make it harder for people to pick out the simple stuff. I'm working on a new release with code for each article/approach. Should have a article out in a few weeks which should help you and other people (I'm working on a contract so limited time at the moment).
There are two databases:
- Standard ASP.NET Core Identity database
- A single database that I split across to DbContexts, so people can see the two parts):
- The extra authorisation classes (see 'ExtraAuthorizeDbContext`)
- An example multi-tenant application (see
CompanyDbContext
)
This second database is created via the CombinedDbContext
using context.Database.EnsureCreated
in the startup code (see program.cs
), which is a cheat way to do it (that's only really used in unit testing).
In a real application you would need some form of migration. I'm with you - I use SQL scripts for migrations and I have a tool called EfSchemaCompare that checks my migration matches what EF Core thinks it should be.
GenericServices - there are example applications showing how to use GenericServices with Razor Pages, MVC and Web APIs. It picks up the DbContext via dependency injection.
from permissionaccesscontrol2.
Hi @asreid212,
Quick update that might help you.
To help developers like you I released a major overhaul of the PermissionAccessControl2 repo over the weekend (make sure to pull the changes) and posted a new article called Part 7 – Adding the “better ASP.NET Core authorization” code into your app. In the article I show how to build a new ASP.NET Core app by copying in code from PermissionAccessControl2
into your ASP.NET Core app.
NOTE: The PermissionsOnlyApp
uses EF Core Migrations and applies any outstanding migrations on startup - that isn't the best way to add migrations (and I don't use EF Core migrations myself), but it makes it easier for people to run the app to see what it does.
I hope that helps you.
from permissionaccesscontrol2.
from permissionaccesscontrol2.
Related Issues (20)
- Exception On "Permanent" Database creation HOT 1
- Feature request - user specific permissions HOT 4
- Unable to create an object of type 'ApplicationDbContext' HOT 2
- Cancellation token may be "default" rather than "new"? HOT 1
- Add Migration: no suitable constructor found for entity type 'ModulesForUser' HOT 3
- Login does not work HOT 10
- Use Roles To Permissions in Angular 8 Core app 3.0 APIs HOT 1
- Invalid object name 'Tenants' HOT 6
- Repackage as a library (or equivalent) HOT 1
- What needs to be unique? HOT 1
- SQL Outputs HOT 1
- ScanAssemblesForDtos Issues
- Querying users with permissions HOT 2
- SubGroup user and shop-level keys HOT 1
- RazorTagHelper Error HOT 2
- No superuser setup and login not working HOT 2
- Missing remove role from user HOT 1
- PostgreSQL instead of MSSQL HOT 3
- Sell menu not visible as a SalesAssistant HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from permissionaccesscontrol2.