Closed juicebyjustin closed 3 years ago
Some github projects use https://readthedocs.org/. @juicebyjustin Do you know? Or do you know something similar to make easy pull requests to docs?
I have not used either @GioviQ. However, this morning I played around and created both a Github page and a Read the Docs project. Both are quick to create the documentation from the repo and auto update on new commits. From testing I believe that Read the Docs is the best option due to the nav bar on the side auto populating when new files are added to the docs.
My Read the Docs site is not perfect due to me playing around. Automapper Read the Docs is a good resource of how a Markdown RTD site could look.
@juicebyjustin Good, but at the moment as a collaborator of this repository I have no permissions to perform ReadTheDocs integration (see https://docs.readthedocs.io/en/stable/connected-accounts.html)
@GioviQ it looks like we need @enkodellc to decide what he wants to do for documentation as he owns this project.
I took this 1 step further today so we could see what Read the Docs would look like with this repos wiki. I forked this project, included the markdown from this wiki in my fork, and published a new branch. My new branch is active on Read the Docs with a custom name. This way we can see what the current wiki would look like in RTD.
This will allow any contributor to modify the wiki with a pull request. @enkodellc if this is the direction you want to go I can create a new issue and make a pull request.
I will review later today. Been a busy lately and did some MatBlazor updates earlier this week. My next free time will be dedicated to BB. Thanks guys for voicing your opinions and your hard work!
I am reading https://read.finnsweb.io/exploring-read-the-docs/#markdown-vs-rest-comparison regarding Sphinx vs MxDocs
The thing that stands out in that read is that Markdown is simple. Sphinx does have the ability to do multiple translations but that requires document writers to write in their language. Whatever is chosen, developers can always write in Markdown and use a converter to get an reST file.
First off I quickly looked through this and watched a couple of vids on RtD and Sphinx
I would like to keep it simple & Markdown is simple as @juicebyjustin mentioned. There are a lot of foreign users that use BB so translations isn't a terrible idea but you won't see me doing anything but English.
I do like having to install python to run Sphinx. I am all for any solution that we can host static files on the repo or my server for the docs. Not a deal breaker though.
From my own quick poking it looks like this tutorial will work?? https://tutos.readthedocs.io/en/latest/source/git_rtd.html
If you both agree this a good path then I @GioviQ if you want to implement on master then give it a shot. I need to spend time on BB soon... I am still working hard on my house doing tile so it is quite hard work. I need to focus on that for my marriage :) If I am not too beat up tonight I will be back at my computer.
@enkodellc I have no problem to setup readthedocs, but registering to ReadTheDocs and to test all the flow, I should have rights to setup webhooks. Maybe you should consider the option to create a GitHub Organizations named e.g. BlazorBoilerplate moved the current repository there and give me access to those settings.
Wiki is superseded by https://blazor-boilerplate.readthedocs.io/en/latest/
Contributors must PR files in https://github.com/enkodellc/blazorboilerplate/tree/master/docs
After cloning the solution and working through adding a new object linked to the database I thought the EF wiki could be updated. The changes are below. I replaced most of the bold with inline code marks.
If you approve this format I have a new page I will submit:
How to Create a New Object
.Entity Framework
Entity Framework (EF) Core is a lightweight, extensible, open source and cross-platform version of the popular Entity Framework data access technology. EF is used for database calls in Blazor Boilerplate.
Documentation can be found here.
Setup
dotnet tool install --global dotnet-ef
dotnet tool update --global dotnet-ef
Source: https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet
DB Contexts
Identity Server 4
There are 2 contexts required for Identity Server 4 (IS4). If new versions of IS4 change the db contexts migrations must be added.
Using EntityFramework Core for configuration and operational data
How to Run Migration for IS4 Update
Will be expanded in the future.
Database Schema Changes and Using EF Migrations
Migrations
Keep in mind that every DbContext has its own migrations.
The migrations in BlazorBoilerplate are stored in the
BlazorBoilerplate.Storage
project. You have to open your shell in this path. Then you have to specify the project where the db contexts are added to the services, because dotnet ef has to know how to find and instantiate them. In our case the so called startup project isBlazorBoilerplate.Server
.The commands are:
ApplicationDbContext:
dotnet ef --startup-project ../BlazorBoilerplate.Server/ migrations add 4Preview3 -c ApplicationDbContext --verbose --no-build --configuration Debug_CSB
PersistedGrantDbContext:
dotnet ef --startup-project ../BlazorBoilerplate.Server/ migrations add 4Preview3 -c PersistedGrantDbContext --verbose --no-build --configuration Debug_CSB
ConfigurationDbContext:
dotnet ef --startup-project ../BlazorBoilerplate.Server/ migrations add 4Preview3 -c ConfigurationDbContext --verbose --no-build --configuration Debug_CSB
Without the
--no-build
parameter dotnet rebuilds the startup project, but if you have just built it with Visual Studio it is just a waste of time. Also the dotnet build is not the Visual Studio build, so to avoid issue use--no-build
.The name of migration, in this case 4Preview3, is only descriptive and it does not need to be unique, because automatically the name is prepended with date time.
If the command is successful,
[datetime]_[migration-name].cs
is added to the solution. Also the[db-context-name]ModelSnapshot.cs
is updated to reflect the db changes in case a new db has to created.Create a Migration
BlazorBoilerplate.Storage.Migrations
.Updating the Database
When you run the project, the migrations are applied to the database. The db table
__EFMigrationsHistory
keeps track of applied migrations without information about the related db context.To get this information use the following command; for example for ConfigurationDbContext:
You can also update the database without running the project with the following command (the migration name
4Preview3
is not required):If you specify a previous migration, you can revert the db changes to that migration.
Warning
The migrations are not smart, when you have an existing db with populated tables. If migrations add keys and/or unique indexes or something else violating referential integrity, you have to manually modify
[datetime]_[migration-name].cs
for example to add some SQL to fix the errors.E.g.
migrationBuilder.Sql("UPDATE AspNetUserLogins SET Id=NEWID() WHERE Id=''");
to add unique values to a new field before setting as a new primary key.Troubleshooting