Massive icon indicating copy to clipboard operation
Massive copied to clipboard

Clear confusion on readme

Open herbertmilhomme opened this issue 6 years ago • 0 comments

The readme makes an introduction or lightly touches on the getting started with massive. However, it begins with

Code Please

Let's say we have a table named "Products". You create a class like this:

public class Products:DynamicModel {
	//you don't have to specify the connection - Massive will use the first one it finds in your config
	public Products():base("northwind", "products","productid") {}
}

You could also just instantiate it inline, as needed:

var tbl = new DynamicModel("northwind", tableName:"Products", primaryKeyField:"ProductID");

Or ignore the object hierarchy altogether:

Massive.DB.Current.Query(...);

But only towards the end, at the bottom, does it ever mention:

Factory Constructor

One thing that can be useful is to use Massive to just run a quick query. You can do that now by using "Open()" which is a static builder on DynamicModel:

var db = Massive.DynamicModel.Open("myConnectionStringName");

You can execute whatever you like at that point.

As if it were an "Oh yeah! We forgot to mention..." My suggestion is to incorporate this sooner or closer to the top, as part of the intro. Possibly if they are not the same thing (which, why wouldnt they be?... idk, it's separated and placed towards the bottom for who knows what reason) provide use-examples to clarify it's design or best case scenario. To me, this var db = ... is the norm, and what i normally look for when messing around with database. But then again, that's why i'm here, and why this tool is so useful. It's because it caters to those who perform inline sql, on a per use basis. Why not give us that little bone at the start of the introductions, rather than towards the end of that major tl;dr?

Since we're all trying to find ways to streamline productivity, it would be a disappoint for me to have missed that part hidden, even way after insert and update. I could've potentially been stuck rewriting lines and lines of code, it werent abundantly clear that hey, maybe i can use something i'm already familiar with

herbertmilhomme avatar Apr 28 '18 14:04 herbertmilhomme