Making it simpler to use

Jun 4, 2016 at 1:45 PM
I used tried RaptoDB and am impressed. Great tool! RavenDB to me always was a bit to heavy weight ;-)

But in order to make it easy for people to get going, I'd like to suggest the following:
  • Make false the default for RaptorDB.Global.RequirePrimaryView
  • Make this the default for views:
this.isPrimaryList = true;
this.isActive = true;
this.BackgroundIndexing = true;
  • Set the view name default to the view's class name
  • Add a Query<Schematypename>() overload to retrieve all items
  • Rename RDBSchema to Schema to become more consistent. (It's View instead of RDBView already.)
  • Add a RegisterView<Viewtypename>() for ease of use
  • Make the query result enumerable so this becomes possible:
var result = db.Query<PersonViewSchema> ();
foreach (var r in result)
    Console.WriteLine (...);
  • Possibly add a way to easily generate a default view for a class, e.g.
var db = RaptorDB.RaptorDB.Open("mydb");

var p = new Person{...};
db.Save(p.Id, p);

var results = db.Query<Person>();
foreach(var r in results)
These suggestions are supposed to make it easier for people to try out RaptorDB and solve simple problems. Once they are on the hook they are willing to add overhead by creating more detailed views etc.
Jun 4, 2016 at 4:11 PM
Thanks ralf!

I will see what I can do (and not break things).

p.s. Query<Person>() will be hard since the return type will be Person too -> Result<T> Query<T>().
Jun 4, 2016 at 5:29 PM
Maybe a fundamental question for RaptoDB is: Does a schema type really need to derive from RDBSchema?

Defining my own views with specific schemas is a neat thing. I'd be willing to do that using special data classes and populate them by hand in the view class.
But why aren't they just plain POCO w/o a base class? Once schema objects are populated, why should there be a dependency to anything RaptorDB specific?

If this dependency can be removed it should be no problem to return Person objects from Query<Person>, i.e. to use the data type Person also as the schema type.
Jun 4, 2016 at 6:39 PM
RDBSchema is only for win form binding when you have fields instead of properties and the docid field/property, so no not really.

In the general case with using T for the document and schema is that the T object can be potentially big with a lot of properties which would impact performance.
Jun 4, 2016 at 10:01 PM
Hm... I find it problematic to contaminate a persistence framework with dependencies to some GUI framework.
I would not recommend doing that. Stay focused on clean persistence. RaptorDB is for retrieving/storing POCOs. That's it. Sending them over a wire or showing them in a GUI is an altogether different topic.

Yes, T can potentially be big. That's why you don't create a view for it automatically.
But when I'm conscious about that and call RegisterDefaultView<T>() with the main data type... well, why not?
As I said, it's to lower the barrier of entry - without doing any harm ;-)