A starting point #35
Replies: 4 comments 4 replies
-
Some Additional NotesCombined [Client Side (WASM) and Server Side project We had discussed developing a combined Client Side (WASM) and Server Side project. The current project has separate Client Side and Server Side projects however as stated the Pages and Components for both projects are shared and contained within TimeKeeper.ComponentLibrary. If we encountered a situation where the same component could not be used on the client and server side projects then we would need to create a client specific version of the code and update the code to include this component when the client project is being used. We may find a better way going forward and there's always the option to try out a TimeKeeper.Combined approach however one advantage of having them separate is that someone could select to publish the client project and host this on a static file server which you wouldn't be able to do with a combined project. Authentication and Authorisation Currently there is none as I didn't want to put in something half baked and muddy the waters in terms of reviewing options. Multiple Startup Projects You will need to enable multiple startup projects with the API selected and either Client or Server. Current Functionality TimeKeeper.ComponentLibrary contains a singe page and two components. It allows you to view time entries added on the current day as well as add a new time entry |
Beta Was this translation helpful? Give feedback.
-
Hey Francisco, Thank you for getting the ball rolling on this one! This is quite similar to where my thinking was going, except for one key thing which would be good to iron out before we start adding new features etc. I wonder if we need quite so many projects from the get go. Going back to some of the discussion points around architecture, I'd generally prefer to avoid adding lots of projects up front. Generally I lean towards vertical slices, rather than horizontal layers for new projects, especially whilst we're finding our feet and getting the first few features under our belt. But I appreciate saying "vertical slices" as shorthand doesn't really mean anything without concrete examples! So, as you say, this is a great place to start/continue the discussion about architecture and what I might do (if you're happy with this) is adapt what you've very helpfully created here in a separate branch. That way we can compare notes (and seek wider input). Thanks again for pushing the ball along the track! It's much easier to think about these things when we can actually see them in action (rather then having endless hypothetical discussions). |
Beta Was this translation helpful? Give feedback.
-
TimeKeeper.Database @DotNetDublin How do I publish to my local sql server? |
Beta Was this translation helpful? Give feedback.
-
Please note that following a discussion with @jonhilt I've created a simplified branch of the above code. In the above branch only code relating to the TimeEntry object remains and any methods not being currently used have been removed. The aim of this is to make it simpler for people to refactor the code should they wish to suggest an alternative approach or implement specific functionality. For example if you had a suggestion for the API controllers you now only need to refactor one controller rather than five. I've created a pull request and invited Jon to review so there maybe further changes. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We've made good progress in our discussions and I felt to progress even further it would be good if we had some code to play with in order to demonstrate options whether it relates to the component library, authentication, database, data access, api, unit testing and everything in between.
To the above end I've pushed a starter project to https://github.com/BlazingSaddlesSolutions/TimeKeeper
Just to reiterate I'm not saying this is how the project should be structured rather it's a starting point that people can use for showing how they would structure the project in comparison. You can also create pull requests to look at individual elements such as data access, the api, authentication, naming conventions or anything else that springs to mind.
Even if your only suggesting how a single line of code be improved it would be most welcome.
I'll now give a high level overview the various projects within the TimeKeeper.sln and will provide more detail when time allows.
TimeKeeper.API
This is a Web API project.
It is called from TimeKeeper.Services and in turn calls TimeKeeper.Repository in order to interact with the database.
TimeKeeper.Client
This is a Blazor WebAssembly project.
All the UI is fed in from TimeKeeper.ComponentLibrary
TimeKeeper.ComponentLibrary
This is a Razor Component Library.
This contains all the UI elements including all Pages and Components.
It uses the component library MudBlazor.
The code within the Pages and Components references TimeKeeper.Services.
TimeKeeper.Database
This is a SQL Server Database project.
For the application to run you will need to publish this project to your local SQL Server or a SQL Server you have access to and update the database connection string within the appsettings.json file TimeKeeper.API
You can find instructions on how to publish the database half way down this article.
Once the database has been created you can use SeedData.sql to add some dummy records
TimeKeeper.Domain
This is a class library project.
Contains the models and validation classes used in the application.
TimeKeeper.Repository
This is a class library project.
Mainly uses Entity Framework to manage the required data access however within the TimeEntryRepository you will find the method GetForUserOnSelectedDateAsync which uses Dapper.
This was more to demonstrate how Entity Framework and Dapper can be used within the same project so we can use either option depending on the scenario.
TimeKeeper.Server
This is a Blazor Server Side project.
All the UI is fed in from TimeKeeper.ComponentLibrary
TimeKeeper.Services
This is a class library project.
Currently the main purpose of the classes within this project are to call TimeKeeper.API however I would envisage classes being created such as EmailService and FileService which would handle email sending and file uploads.
Beta Was this translation helpful? Give feedback.
All reactions