massive

query a list of dynamic objects

独自空忆成欢 提交于 2019-12-24 01:04:14
问题 I am using massive to get the config table in the database. I would like to cache the config since the app gets values from it all the time. once cached is there an easy way to find the object where name = 'something' here is where the whole table is cached. protected override dynamic Get() { var ret = HttpRuntime.Cache["Config"]; if (ret == null) { ret = _table.All(); HttpRuntime.Cache.Add("Config", ret, null, DateTime.Now.AddMinutes(2), Cache.NoSlidingExpiration,CacheItemPriority.Low, null

Allow mapping of dynamic types using AutoMapper or similar?

泄露秘密 提交于 2019-12-17 10:12:31
问题 I've started to use https://github.com/robconery/massive for a project, I wonder if there is any mapping tool that allows support for Dynamic to static type mapping? I've used AutoMapper previously, does AutoMapper support this? I am aware of the DynamicMap function from AutoMapper, however I believe this function is for running maps without creating the Map first. In my example below it does not work. dynamic curUser = users.GetSingleUser(UserID); var retUser = Mapper.DynamicMap<UserModel>

How to update a table with composite keys using Massive ORM?

一个人想着一个人 提交于 2019-12-12 12:11:02
问题 Using Rob Conery's Massive micro-ORM; is it possible to work with tables that have composite keys? I can't quite see how to assign more than a single column name as 'PrimaryKeyField'. Anyone managed to do so? More specifically; How do i do an Update() when the primary key consists of two columns? 回答1: Found this comment on GitHub; https://github.com/robconery/massive/pull/50 - with the following comment from Rob; (...) I've had this discussion with others (using SubSonic) with respect to

Using Massive Insert I get DBNull when trying to get scope_identity()

落花浮王杯 提交于 2019-12-11 02:45:50
问题 I have a table with an identity column. Using Massive with code like this var table = new Categories(); var newID = table.Insert(new {CategoryName = "Buck Fify Stuff", Description = "Things I like"}); then table.Scalar("select scope_identity()"); returns DBNull :( What do I need to do different to get the actual inserted identity value 回答1: The MSDN documentation states that SCOPE_IDENTITY: "retrieves the last identity values that are generated in any table in the current session" Looking at

Servicestack ORMLite/Massive managing multiple DataTables with Expandos / Dynamic?

假如想象 提交于 2019-12-11 00:07:35
问题 i have a Stored Procedure that returns multiple datatables with dynamic types according to the input and I cannot modify or split it. I actually retrieve the data in this way: var massiveModel = new DynamicModel(dbConn.ConnectionString); var connection = new SqlConnection(@"Data Source=127.0.0.1;Initial Catalog=TEST;User ID=as;Password=;Application Name=BRUCE_WAYNE"); connection.Open(); var massiveConnection = connection; var tmp = massiveModel.Query("exec MY_SP 4412 '20131016' ",

Massive with WCF Web Api to return dynamic types/Expandos?

感情迁移 提交于 2019-12-07 19:57:55
问题 I want to use Massive for data access with WCF Web Api and return either dynamic or ExpandoObject / IEnumerable<ExpandoObject> from my web api. I have this basically working using a JsonNetMediaTypeFormatter which uses Json.NET's ExpandoObject serialization, but everything gets returned as a Key-Value pairs in the Json such as: [ { "Key":"ID", "Value":"1000" }, { "Key":"FirstName", "Value":"John" }, { "Key":"LastName", "Value":"Smith" } ] But, what I want is: [ { "ID":"1000", "FirstName":

Count on an IEnumerable<dynamic>

百般思念 提交于 2019-12-07 06:19:57
问题 I'm using Rob Conery's Massive ORM. Is there an elegant way to do a count on the record set returned? dynamic viewModelExpando = result.ViewData.Model; var queryFromMassiveDynamic = viewModelExpando.TenTricksNewestFirst; //fails as have actually got TryInvokeMember on it var z = queryFromMassiveDynamic.Count(); //works int i = 0; foreach (var item in queryFromMassiveDynamic) { i++; } 回答1: Rather than calling it using the extension method member syntax, try calling the static method directly.

Accessing stored procedures with robconery / massive?

一世执手 提交于 2019-12-07 02:20:12
问题 Another great article by Rob on the Massive ORM. What I haven't been able to find is references on how to access stored procedures. SubSonic had some issues with the overhead of using ActiveRecords, so I preferred to do data access with stored procedures, still using the SubSonic ORM. What I haven't yet seen is outright support for things like SQL Server's TVP's in an ORM, so I modified SubSonic (shameless plug) to support them. Is it possible to access SQL Server sprocs with Massive.

Updating SQL Server 2008 records w/spatial data types via Massive ORM (ExecuteNonQuery), UdtTypeName error

蓝咒 提交于 2019-12-06 07:36:36
问题 I'm trying to use Massive "dynamic ORM" by Rob Conery to query my DB (working GREAT so far). Ran into a problem when I added a Geography field to my tables. Here's the error: UdtTypeName property must be set for UDT parameters Update (14Apr2011): The ADO method that is throwing the exception is .ExecuteNonQuery(); Here's the method from Massive.cs that throws the exception: public virtual int Execute(IEnumerable<DbCommand> commands) { var result = 0; using (var conn = OpenConnection()) {

Massive with WCF Web Api to return dynamic types/Expandos?

我是研究僧i 提交于 2019-12-06 07:30:15
I want to use Massive for data access with WCF Web Api and return either dynamic or ExpandoObject / IEnumerable<ExpandoObject> from my web api. I have this basically working using a JsonNetMediaTypeFormatter which uses Json.NET's ExpandoObject serialization, but everything gets returned as a Key-Value pairs in the Json such as: [ { "Key":"ID", "Value":"1000" }, { "Key":"FirstName", "Value":"John" }, { "Key":"LastName", "Value":"Smith" } ] But, what I want is: [ { "ID":"1000", "FirstName":"John", "LastName":"Smith", } ] As if I were using a concrete type like: public class Customer { public int