Forum Xamarin.Forms

How is my project suppose to work?

IvoFreitas.2310IvoFreitas.2310 USMember
edited April 2017 in Xamarin.Forms

I'm new to app development and I'm using a book (Xamarin Mobile Application Development to guide me through the learning process.
My problem is not knowing how to work with the bunch of classes that the book guided me to create and how things should flow to work properly.
The first step described is to create a structure Model - ViewModel and a View (MVVM pattern), examplifying, I created a model called Produto and ObservableProduto (creates an instance of Produto and implements INotifyPropertyChanged), then a viewmodel called ListViewModel (creates an ObservableCollection and populates it with ObservableProduto's on the constructor) then I created a page and displayed it.
At this point, I thought that I needed to save some of the data on a database, so the book guided me to use SQLite.NET. I created an interface IDatabase with SQLiteConnection DBConnect() and I implemented it on Android and iOS. Next, I changed Produto to have SQLite attributes like [Primary Key], [AutoIncrement], etc, then I created a class with generic CRUD methods called GenericDA and a class ProdutoRepository calling GenericDA methods with an instance of it.The final step was to create inside the App class (project default class) a public static property ProdutoRepository called repository that I can access in the entire project to store data.
My doubt is, after all, how it can work and if I need all these classes to manipulate it.
If needed, I can share the project and talk more about it.

Thank you.

Sign In or Register to comment.