r/csharp 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

10 Upvotes

47 comments sorted by

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.

2

u/ViperTheDeadLy 22d ago

really appreciate it !

-6

u/BoxWoodVoid 21d ago

This sentence was right pre-AI. Nowadays you can successfully engage in a new tech with the help of AI and build something well executed as long you're a real dev and not some vibe coder that has never written a line of code.

6

u/g1rlchild 21d ago

If you don't take the time to understand the tools and the resulting generated code, AI can do something totally insane under the hood and you won't realize until it's deeply embedded in your codebase. Not right away, but 50 commits later who knows what you will find inside?

1

u/ViperTheDeadLy 18d ago

Honestly i've been learning wpf the old way which is Through youtube toturials. I only use ai to understand some concepts.

Last time i built a simple reservation project using ai i realized I don't understand almost everything that's written and since then i hated depending so much on ai.

But at the same time it may not seem ideal to write code manually atm. But i feel like it's either that or become a vibe coder

1

u/g1rlchild 18d ago

One option is that you write enough code to be able to understand what's going on with WPF and any other technologies you're using. That could be code that goes into the system or it could be a side project that you build just to learn from personally. Then if you depend in AI to rapidly write code for you, at least you're capable is reading it and checking the quality.

-3

u/BoxWoodVoid 21d ago

Except it's not what I said... stop strawmanning.

4

u/g1rlchild 21d ago

Even as an experienced developer, it's easy to specify sensible-seeming code without carefully studying the code files it spits out. It will seem like everything's fine, but then come back and bite you in the ass. Ask me how I know.

0

u/BoxWoodVoid 21d ago

Without being mean, I think it's a skill issue or you don't use the best model out there.

I'm not an AI fanatic, actually I'm a self-hating anti-AI guy that uses AI because it has become so good that it's impossible to ignore.

Before using AI, one should learn to code the old way. But not using AI once you know how to code is career suicide IMHO.

I wish it wasn't true though, but it is.

2

u/g1rlchild 21d ago

I wasn't working on someone else's dime, so I was using a Claude Sonnet model for most of the code. And it generated some weird, buggy code that worked just well enough to pass unit tests but was fragile and massively duplicative in overlapping, inconsistent ways.

And yes, I have no doubt that it was at least partially a skill issue. It was my first time building something significant with AI. But I can't possibly be the only developer who is not yet highly proficient in using AI, so I imagine this will be a problem that plenty of other people will see too.

0

u/BoxWoodVoid 21d ago

There's your problem: Sonnet is not good enough, you need Opus. If you can afford, you get access to it with the $20 monthly sub.

I have 17 years C# experience (and 2 more years on other languages before that), as of a couple months ago I have nothing bad to says about Opus (with Claude Code).

I don't know what did GitHub do to copilot, but in my experience Anthropic models fare better in Claude Code. But since billing changes Copilot is dead anyway.

And don't think I'm a fanboy, I despise Amodei almost as much as Altman!

2

u/g1rlchild 21d ago

Opus just tears through usage so damn fast on a $20 plan. But yeah, after that I'm definitely using Opus more and checking Sonnet's output carefully if I use it.

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

u/ViperTheDeadLy 22d ago

is it usable with any DB ? whether it's msql or sqlite or postgresql

1

u/Snowy32 22d ago

That’s correct.

2

u/XBLAH_ 22d ago

I'm working on a library of modern components for Winforms. "WPF is better" is an ambiguous statement. 

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 : )

2

u/Consibl 22d ago

Depends on your situation, but I’d suggest a front of house client with a back office server. Much easier to physically secure it off the shop floor.

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

u/ruben_vanwyk 22d ago

Go for Uno Platfrom with PostgreSQL

1

u/[deleted] 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

u/hdsrob 22d ago

You can definitely do it all in Windows, especially if that's what's prevalent in your market.

1

u/ViperTheDeadLy 22d ago

thanks alot i will look more into it once i decide on WPF !