dradovic / MigSharp

Mig# (MigSharp) is a .NET framework for database migrations and versioning
Other
106 stars 33 forks source link

Insert method #35

Closed nicholassuter closed 11 years ago

nicholassuter commented 12 years ago

I am currently migrating from Fluent Migrator to MigSharp, and the only feature I miss is an IDatabase.Insert() method such as : Insert.IntoTable("Users").Row(new { FirstName = "John", LastName = "Smith" }); (https://github.com/schambers/fluentmigrator/wiki/Fluent-Interface)

I know I can work around this with IDatabase.Execute(), but an Insert method is cleaner, easier to write and most of all written in C# and not SQL.

dradovic commented 12 years ago

Notice that Mig# does not offer any data manipulating operations. It is about schema changes only because this is the part, where different platforms differ and there are no standards.

As for data manipulation such as inserting, updating, deleting records, or copying tables, etc., it can be done in many ways. The syntax you present is only one possibility, but there are plenty other approaches which might be more suitable for different users. There are libraries that specifically address this concern. To add this to Mig# would mean to open a door to a completely different area and I don't want to do this to keep the scope of Mig# well defined and lean.

Note that you could easily implement your own extension method on IDatabase that provides you what you need.

nicholassuter commented 12 years ago

I did notice :) The syntax I gave was exactly what you said : an example. I just found these methods really convenient in Fluent Migrator, since this enabled me to replace all my SQL scripts by C# migrations : manipulating the schema and populating the tables. When you mention other libraries, I suppose you mean ADO.NET and untyped DataSets for instance.


De: dradovic reply@reply.github.com : nicholassuter nicholas_suter@yahoo.fr Envoy le : Mardi 7 fvrier 2012 7h01 Objet: Re: [MigSharp] Insert method (#35)

Notice that Mig# does not offer any data manipulating operations. It is about schema changes only because this is the part, where different platforms differ and there are no standards.

As for data manipulation such as inserting, updating, deleting records, or copying tables, etc., it can be done in many ways. The syntax you present is only one possibility, but there are plenty other approaches which might be more suitable for different users. There are libraries that specifically address this concern. To add this to Mig# would mean to open a door to a completely different area and I don't want to do this to keep the scope of Mig# well defined and lean.

Note that you could easily implement your own extension method on IDatabase that provides you what you need.


Reply to this email directly or view it on GitHub: https://github.com/dradovic/MigSharp/issues/35#issuecomment-3843092

dradovic commented 12 years ago

There are a couple of other libraries. I remember evaluating some, that it's too long to remember names. I just found http://www.codeproject.com/Articles/16610/SQL-Statement-Generator and http://stackoverflow.com/questions/7172008/c-sql-query-builder-class with a quick Google search. But there are others, too...

dradovic commented 11 years ago

In order to keep the scope of Mig# clearly defined (schema ops and not data ops), this feature will not be implemented. As said, there are other libraries out there that provide this functionality.