Efficient linked lists in .NET

Exercises in .NET with Andras Nemes

Sometimes you need a collection that’s modified a lot: you insert, update and remove items. A List of T is then inefficient as it needs to constantly rearrange all other items. The LinkedList class might be a better candidate.

A linked list is a doubly-linked list. Each item has a Next and Previous pointer to look at which element comes right before and after a particular object in the list. A linked list is very efficient at inserting and deleting items in particular.

Initialisation:

View original post 181 more words

SQLite EntityFramework 6 Tutorial

ErazerBrecht's Blog

Hello,

UPDATE 13/10/2015/
I made another post about MVVM and EntityFramework. After reading this, you should really check that one out!
It’s really worth it to use MVVM 🙂
Link to another post: Click Here

I’ll explain the basics to get SQLite working with EntityFramework 6. It’s a straight forwarded tutorial / explanation. I will not tell you everything about EF (there are a lot of tuturials on the web). Instead I’ll show you the most basic example to get EF working with SQLite, after all it wasn’t that easy!

View original post 1,783 more words

Mocking Entity Framework DbContext with Moq

Mirko Maggioni

When we have to test methods that involves Entity Framework, a typical choice that we have to face is use integration tests, with an effective database, or unit tests.

If we choice the first option, with a database like SQL LocalDB, we’ll have performance problems because the cost of the database creation and the data inserts in the test startup is very high, and in order to guarantee the initial conditions we’ll have to do it for each test.

What we can do is use a mock framework that help us to mockup the entity framework context; it would be an in-memory db context, like the in-memory db context of .NET Core, that we have seen in this post.

The factory

In pratice, mocking a class means substitute the real implementation of a method with our custom behaviour; what we can do for every method of the class is…

View original post 482 more words

Blog at WordPress.com.

Up ↑