Starcounter / Home

Starcounter is an in-memory database application engine.
https://starcounter.io
27 stars 1 forks source link

Feature Request - Allow visual studio c# interactive to connect to an existing db #436

Open Razkan opened 6 years ago

Razkan commented 6 years ago

Summary

As of visual studio version 15.8, support for 64-bit C# interactive has been added. This means that starcounter dll's can be loaded to the interactive, making it a mean to load project and to CRUD an active database during runtime with plain C# code, while for example debugging.

Proposal

Allow for the Db or Db.Enviroment to be set through the interactive.

Db.Connect("Default");
Db.Enviroment.Set("Default");

Examples Usage

> #r "C:\Program Files\Starcounter\Starcounter.dll"
> using Starcounter;
> Db.Environment.Set("Default");
> var user = Db.SQL<User>("SELECT u FROM Db.Users u WHERE u.name =?", name).FirstOrDefault();
> Db.Transact(() => user?.Delete());
miyconst commented 6 years ago

@Razkan please keep in mind that user defined assemblies with [Database] classes would have to be loaded as well.

@per-samuelsson would you be able to investigate this?

Razkan commented 6 years ago

@miyconst Visual Studio allows you to initialize the interactive with a project, where both user defined and starcounter assemblies would be loaded to the interactive by right clicking a project and choose Initialize interactive with project.

per-samuelsson commented 6 years ago

@per-samuelsson would you be able to investigate this?

I guess I can yes, although I don't think I have any better knowledge of it than any body else. When you want me to schedule it? Right away?