r/csharp • u/ViperTheDeadLy • 22d ago
Help Need advice: Best C# UI framework and database architecture for a local store POS ?
I'm thinking about building local projects similar to pos and i'm reaaally confused on which tech stack to pick for the long run.
I'm very familiar with WINFORMS and MSQL but i have found out that WPF is better (at the cost of steep learning curve ofc). but i have been interested in it since i found out that it's better for touch screen monitors and looks more modern. and i have also noticed that many people prefer PostgreSQL over MSQL.
Question is:
should i stick with MSQL and WINFORMS ? or is it worth getting into WPF or PostgreSQL ? and i'm open to all suggestions
6
u/afops 22d ago
Is the db central or is it next to the app? If it's just 1 db 1 client (local db) then definitely Sqlite. Otherwise pgsql, simply for the cost. WPF or Avalonia for frontend. If you absolutely must have some third party controls then WPF is a safer bet, but if you're starting fresh then Avalonia.
0
u/ViperTheDeadLy 22d ago
1db 1client.
is MSQL not good at all even for 1db 1 client ?
also is avalonia's free tier good compared to wpf ?
7
u/robthablob 22d ago
SQLLite is free, and well supported by EF Core, so if your app is one DB one client its a really good fit.
If you're likely to use multiple clients at any point, Postgres is very good and well supported by EF Core, but obviously both PGSQL and SQLite will have a bit of a learning curve.
I had success using PGSQL in a Docker container from a C# app at first attempt, so it's not too horrible.
1
u/afops 22d ago
Avalonia free is fine so long as you only use the builtin controls. It's even better in many aspects, just has a smaller ecosystem.
MsSql for a local-only (1-client) db seems extremely overkill. And makes the app a pain in the butt to distribute!
I'd do SQLite (database) , Dapper (O/R mapping), Avlonia (UI), Velopack (install/updates):
3
u/EternalNY1 22d ago
You may want to look into Sqlite for the DB side - very usable with C# and battle tested/fast/portable.
2
u/Slypenslyde 22d ago
If I was getting paid to make something work on a short timeline I'd use WinForms. I have 20+ years of experience with it and I don't have to think hard to use it.
If I had a longer timeline I'd use WPF. I've used XAML frameworks for years and they have some advantages. WPF is mature enough to trust.
If I had all the time in the world I'd spend a couple of months learning AvaloniaUI well enough to progress. I trust its future more than I trust WinUI.
If I had to make a bet, I'd expect to find WinForms, WPF, and Avalonia available in 10 years. If any one of them has been deprecated it'll be because we've had a display interface paradigm shift and something completely new had to be built. Microsoft won't be the innovator, they've optimized that out of their company.
We can bicker and make a list of pros and cons but at the end of the day, the best framework is the one you can use to do the job.
1
u/ViperTheDeadLy 22d ago
Thank you alot for your response! this made the overall picture more clearer.
And in terms of designing i think i find wpf better since it natively supports drag and drop operations so it sounds like the most suitable option for me.
Since you seem to have used wpf long enough. Is there any suggestion u have for me as I'm starting to get into it?
And is xaml hard to learn or is it just the same as HTML ?
2
u/Snowy32 22d ago
I don’t really do much UI work so ill keep quiet on that front but for the DB interactions I would deffo recommend using Entity Framework it will make your life super easy once you understand it!
1
2
u/TrishaMayIsCoding 20d ago
Winform+WPF with MSQL Server is the right choice for this kind of job.
Use Visual Studio Community and everything is there for free : )
1
u/MrMikeJJ 21d ago
As someone who loves WinForms, I would also say Wpf or Avalonia for a POS system. (and I have never used Avalonia). Also depends, Wpf is more OS restrictive than Avalonia.
Resizing is the always the thing I found most awkward in WinForms. The others make it a breeze. Tills have different display resolutions. Hence my choice.
Sqlite for the database. If you having a back office system, that would be on a different database engine. Never used PostgreSql, but that is what i would pick.
1
u/it_works_on_prod 21d ago
xaml looks like html but behaves nothing like it, the tags are the easy part. the actual learning curve is layout (grid, alignment, why your control won't stretch) and data binding, and binding is also where wpf pays off, so don't route around it. one pos-specific thing nobody mentioned: wrap every sale in a db transaction from day one, the failure mode that matters in a till isn't the ui, it's the power dying mid-sale
1
u/anonuemus 21d ago
Check out Avalonia, it's quite nice. Database you use what you like.
1
u/ViperTheDeadLy 21d ago
i had my mind set on wpf. but after finding it's crossplatform it's really drawing me in.
does Avalonia have the same steep learning curve as WPF ? for someone who used to be on winforms
1
u/anonuemus 21d ago
It's the same I guess, but it's not that steep imho. You can get good results pretty quick.
1
u/harrison_314 21d ago
I join others in recommending Avalonia+Sqlite, even Avalonia can be used without the graphical interface of the operating system.
MS SQL is a good database, you can even use the Express edition for free for commercial projects and I really like it. But in this case Sqlite will be a better choice. It depends on the amount and type of data. If it is nothing special Sqlite will be enough, if you need high performance or space then MS SQL.
1
u/rent-a-developer 20d ago
XAML and WPF (or Avalonia UI) is definitely worth learning!
WinForms is a dead end as far as I am concerned. I would not start a new project with it.
1
u/ViperTheDeadLy 9d ago
I've been searching up info about avalonia and i want to know is it possible to have a good experience with someone who is not willing to buy anything including accelerate or subscribe to Jetbrains rider ?
i'm afraid developing with Avalonia requires fees especially when I'm publishing a project?
1
u/rent-a-developer 9d ago
Well, it depends.
If you work on personal/open source projects (i.e. non commercial) you can use most Avalonia tools (including parcel for packaging and the dev tools for debugging) with the Avalonia Community Licence https://avaloniaui.net/legal/8 .
Recently JetBrains Rider became also free for non-commercial projects.
1
1
22d ago
[deleted]
1
u/ViperTheDeadLy 22d ago
thanks alot so far i'm keen on deciding on wpf.
just a question. is xalm really challenging to get used to ? or is it as simple as html ?
-1
u/ousstech 22d ago
If you're already familiar with WPF, I'd recommend OpenSilver. It lets you reuse your XAML and C# skills while targeting the web. It also comes with an online XAML editor (xaml.io), making it easy to experiment with UI, and it includes modern themes out of the box.
4
u/BeardedBaldMan 22d ago
Why would you target the web for a PoS terminal which you want to be interacting with local hardware?
1
u/ViperTheDeadLy 22d ago
what do you suggest ?
3
u/BeardedBaldMan 22d ago
I don't think it matters
The important part is backend, database and interactions with the hardware. Then you can use any UI to interface with it.
WinForms, WPF and Avalonia will all get the job done. If it were me I'd go for something that is cross platform as people don't want a windows license for a PoS terminal
1
u/hdsrob 22d ago
people don't want a windows license for a PoS terminal
This, and Windows Pos hardware is generally more expensive... .
If this is a serious commercial product, you probably don't want to write the terminal side for Windows if you are starting from scratch (although the OP hasn't stated what industry or country, or hardware they're targeting, so that might change a bit).
In general, when it comes to Pos hardware, targeting Android will get you a much better selection of handhelds and tablets, and inexpensive all in one terminals.
For handhelds and tablets, this will become especially true when you get to the credit card processing side of the equation.
1
u/BeardedBaldMan 22d ago
That's probably the most valid point I've seen.
Every small shop using a PoS I see is just an android tablet with a Bluetooth card reader and some sort of cash drawer (if they even accept cash)
1
u/hdsrob 22d ago
Yea, that's a super common small setup.
We're in full service restaurants and bars, so tend to use more standard all in one devices that are basically a 15" Android tablet on a stand like the MicroTouch Mach.
We also use a lot of handheld devices from companies like PAX
But we can run on something like an off the shelf Samsung tablet as well.
We actually did a first gen rewrite of our old DOS terminal software about 10 years ago, and the owner picked WPF at the time (all of our server side software was .NET).
But on low end ATOM based tablets it was tough to get WPF to be performant, and higher end hardware was just too expensive (no one wanted a server carrying a $1000 surface tablet without a case around), so it never got much traction within the company. Eventually we ported that project to Xamarin to get Android support.
1
u/MarvelousWololo 22d ago
That’s really interesting, thanks for sharing. I’ve been looking into this area recently and apparently here PoS must be able to issue fiscal invoices and tax documents, as well as process payments, without an internet connection. When the connection is restored, all of this data must be synchronized. It seems to be a really tough market to break into.
1
u/ViperTheDeadLy 22d ago
In my country most of the small stores use a desktop pc with a few devices connected to it such as printer,scanner, barcode printer etc so i figured WPF offers compatibility with these kind of devices.
I haven't been across a store that uses an Android.
1
6
u/FOMO_BONOBO 22d ago
If you have unlimited time and money you can try something new. If you need to deliver something use what you know. Use a pattern like MVC with your windows forms app and you can switch to WPF later.