Navigation Concept and More of Errors Solving

Since I have completed the PurchaseInvoice module, I needed to fix errors that are present and check the codes again.

Firstly, I started by checking the property isAllPurchaseInvoiceReceived, by checking from the UI to see if the property gets flagged when all invoices are received, and hence after checking, I had to change the logical property of quantity to ensure that if a quantity more than ordered is received the property, then it will not be flagged or be true in its boolean expression.

Next, another error which was found is that when a user creates a GoodsReceive and PurchaseInvoice from PurchaseOrder, the GoodsReceive can afterwards be used when creating a PurchaseInvoice from GoodsReceive, which will result in having an Invoice with the same quantity number received but different cost which is a conflict. To solve the error, the relationship between GoodsReceive and PurchaseInvoice was adjusted by using the EF Core concept of relationships One-to-One by defining the relationship in the config file.

I have also pulled codes from Git and adjusted few parts, that resulted in the project to be using tabs navigation concept instead of dialogues. Such that a user, can have multiple tabs opened at the same time and each is independent on the other. At the same time, this current navigation is more user friendly.

WPF allows the concept of using a ViewModel without getting access to its View. In other words, it loads the codes and knowledge from a ViewModel without taking the view into consideration.

Another information I learnt from GitHub was when pulling if we are not present in the designated branch then we won’t be able to see the changes that have been to the codes. As pulling without being in the branch does not grant us access to the changes made.

See you all next week 🙂

More about Entity Framework

I started getting more familiar with EF Core, although I don’t fully understand everything, I am able to grasp the main idea of how EF Core works, because I helped a friend who is doing his internship as well and was asked to use EF Core and had no idea how to use it. So, I was able to guide here and there which shows that I did learn something about EF Core after all.

If you find difficulties in understanding what I’m about to discuss refer to my previous blog by clicking on this link before proceeding https://www.tonghin.com.my/blog/2021/03/04/entity-framework-core-week/.

I finally have a better understanding of how tests work, and how to write a unit test in general.

A unit test compromises of 3 sections. Firstly, the arrange part which sets the environment for the test components. Next, act initiates the test or does the testing. Lastly, assert validates and verifies the result we expect to get by comparing our expected value to the value retrieved from the act section.

Last week, I wrote around 7 tests with the help of my supervisor, who guides me when I don’t understand or get stuck at one point or another.

Among the widely used assert extensions are First( ), Select( ) and Where( ). More information can be read from the below link https://www.tutorialsteacher.com/linq/what-is-linq.

The concept of Rollback( ), Commit( ) and Complete( ) in a transaction is among the things that I have been exposed to as well, whereby rollback undoes changes that have been committed into the database. Commit on the other hand, saves changes into the database, while complete saves the transaction, it does not update the database if commit was not initiated, as well as if complete was not written in the codes, updates that have been made wont be saved even during debugging of codes.

The keyword using in C# is used to ensure that the method dispose( ) is called after a method has been called, or or an object has been created and many other things. Dispose( ) is used to release unmanaged resources, but it does not free a managed memory.

That’s all for this week 🙂

Entity Framework Core Week

Getting familiar with EF Core is not easy at all.

Last week was hectic, I really had a lot of trouble trying to understand how EF Core works and understanding its concept, to the extent that I told my parents, I guess my supervisor regrets taking me as an intern, hahhahah.

So entity framework can simply be defined as an object which maps database to .NET. Mainly, Entity Framework (EF) and Entity Framework Core exist, such that the latter is an advanced version of EF and it supports features that EF cannot support .

EF Core is what we use at Tong Hin. It works by creating model classes and context objects which represent sessions with the database. Migrations are then used to create the database and update it as the model evolves and changes. EF Core supports relationships in database, ranging from One-to-One relationships, One-to-Many relationships, and Many-to-Many relationships.

EF Core can be used for querying and retrieving data from the database, save, edit and delete data. Taking note that all these functions are done in the model class of the entities.

The concept of EF Core is a lot, I will mention more about it in the next upcoming blogs.

Next, I was introduced to fluent assertion, which makes the assertion statement readable to anyone who has a look at the codes instead of using the statement Assert(2, 4), the following statement is more readable and understandable Answer.Should( ).Equal(2).

Clean code is a concept which involves ensuring that the codes written are easier to understand and are easier to change. Clean code can be written by adhering to the following basic guidelines which are, writing meaningful names, writing correct comments, following the standardized format of code writing, removing and refactoring unnecessary classes, and many other guidelines that can ensure that the codes written are considered as a clean code.

See you all next week again 🙂