0
I’m developing an application for leasing-related business management purposes. The trivial CRUD, reports, controls etc, commonly developed in windows Forms. However, I am making a UWP application.
The dilemma begins with the fact that UWP applications cannot access the ADO.NET classes, so the only way (I knew) UWP apps work with databases is via Webservice. The problem is that I am having some difficulty trying to fit the whole rule related to data persistence within the Webservice. I searched for information on what would be the best way to do this and found suggestions to create a service for each entity to be persisted in the database, but I do not find a solution very practical and "elegant".
I also thought about creating generic CRUD methods that could persist any type of entity, that is, a single insert(AnyType anyData)
to insert any set of data in its appropriate table. But I could not advance the reasoning, because each entity is very particular. Some have more properties than others, others have collections like properties (List
, Dictionary
), which will be persisted in separate tables (Example: LEASE and ITENS_DA_LOCATION), others do not have, some are extremely simple and some are more complex.
Finally, creating a generic CRUD methods is not a simple task.
What other solution could I try in this case?
I can’t say if you can’t access the database, you might not be able to use ADO.NET, but it’s a specific restriction. You need to see if you need to do UWP, it may not be the most appropriate option. Even if you do *please access the database from another source, there are several other ways to do this without it being a webservice. It may be that UWP has some restrictions that I don’t know, but if this is true for me it is not good for virtually anything, until you create an app on iOS can more.
– Maniero
Almost everything you have on the Internet are complex solutions to problems that should be complex, but most problems are simple.
– Maniero
I decided to go via UWP to take advantage of the visual resources of UWP. There is
WPF
but UWP introduces a lot of new things and makes it easier to create certain components than inWPF
would be painful to do.HamburgerMenu
in theWPF
is a birth, already in theUWP
there is the component ready. You said there would be other ways to work withUWP
and database. What would be?– Matheus Saraiva
I’ve never used UWP and I don’t know it well, but as well as being clear that it has what it takes, there are a few things out there: https://code.msdn.microsoft.com/How-to-access-data-from-5f2602ec, https://docs.microsoft.com/en-us/windows/uwp/data-access/, https://blogs.owwinds.com/buildingapps/2017/02/06using-sqlite-Databases-uwp-apps/#9u5tL2h4WuwOhpGr.97. Can access the database through a service, but does not need to be webservice, maybe by TCP/IP, has many ways
– Maniero
If it is a single-user application could choose to
SQLite
(local storage). Other situations at the moment do not see a solution other than something related to service. It doesn’t treat exactly as you say in the question'um serviço para cada entidade'
, a service serves yes all entities. I’m also starting to learn this part ofwebservice
dotnetcore already has a lot of material on the subject, along withefcore
we can already start to create services. These are recent technologies but the trend and evolve.– rubStackOverflow
The function of
WebService
would not be exactly working with data manipulation but rather receiving and responding to customer requests. The work of data manipulation would be done for example by adll (Projeto c#)
. I recommend (if you don’t already know) learning about efcore (Entity framework core) https://docs.microsoft.com/en-us/ef/core/index– rubStackOverflow