subsonic3

Subsonic 3.0 UPDATE, multiple conditions

痴心易碎 提交于 2019-12-24 08:57:17
问题 db.Update<Luna.Record.TB_ITEM>().Set( x => x.ITEM_DURABILITY == Convert.ToInt32(quantity)) .Where(x => x.ITEM_POSITION == Convert.ToInt32(position)) .Execute(); How will I add an AND clause this is how it looks like in plain SQL: UPDATE TB_ITEM SET ITEM_DURABITLITY=@quantity WHERE ITEM_POSITION=@position AND CHARACTER_IDX=@charidx 回答1: .Where(x => x.ITEM_POSITION == Convert.ToInt32(position) && x.CHARACTER_IDX == Convert.ToInt32(charidx)) 来源: https://stackoverflow.com/questions/2623115

Left Join in Subsonic 3

北慕城南 提交于 2019-12-24 06:35:00
问题 I'm trying to do a left join in subsonic 3 using linq but it doesn't seem to work, I get a big error. var post = from p in Post.All() join q in Quote.All() on p.ID equals q.PostID into pq where p.ID == id.Value from qt in pq.DefaultIfEmpty() select new {p, qt}; I'm using subsonic 3, latest GIT version from Rob, but I'm getting an error, see below, when I try a left join. I have searched but I didn't found any solution. Can anyone explain to me why the error and how to fix it? Thanks

SubSonic 3.0.0.2 Structs.tt

﹥>﹥吖頭↗ 提交于 2019-12-23 12:23:44
问题 The error I'm getting seems to be coming out of the Structs.tt file. I'm using the Northwind db and only using the Products table (I excluded all other tables). I return Json(Product.All()). Here's the error: A circular reference was detected while serializing an object of type 'SubSonic.Schema.DatabaseColumn'.Here's the Stack Trace: System.InvalidOperationException was unhandled by user code Message="A circular reference was detected while serializing an object of type 'SubSonic.Schema

Atomically increment a field using SubSonic 3 ActiveRecord

落爺英雄遲暮 提交于 2019-12-23 03:18:21
问题 I'm tring to increment a field in a MySQL database using SubSonic 3 ActiveRecord. In SQL, this is what I'm after: UPDATE people SET messages_received=messages_received+1 WHERE people_id=@id_to; I tried the following, but it didn't seem to work (messages_received always seemed to be 1): _db.Update<person>() .Set("messages_received").EqualTo(x => x.messages_received == x.messages_received + 1) .Where(x => x.people_id == idTo) .Execute(); This did work: string sql="UPDATE people SET messages

Object mapping with LINQ and SubSonic

萝らか妹 提交于 2019-12-22 00:29:43
问题 I'm building a small project with SubSonic 3.0.0.3 ActiveRecord and I'm running into an issue I can't seem to get past. Here is the LINQ query: var result = from r in Release.All() let i = Install.All().Count(x => x.ReleaseId == r.Id) where r.ProductId == productId select new ReleaseInfo { NumberOfInstalls = i, Release = new Release { Id = r.Id, ProductId = r.ProductId, ReleaseNumber = r.ReleaseNumber, RevisionNumber = r.RevisionNumber, ReleaseDate = r.ReleaseDate, ReleasedBy = r.ReleasedBy }

MVC.net + subsonic Auto Generate MetaData Classes from TT

六月ゝ 毕业季﹏ 提交于 2019-12-21 05:58:23
问题 Not a question but i dont have a blog and i have just created a new subsonic TT file that will generate the Metadata classes automatically for the subsonic classes so you can skip out some work when using dataAnnotation and CreateForModel etc so the first step is to amend your ActiveRecord.TT with the following using System.ComponentModel; using System.Data.Common; using System.ComponentModel.DataAnnotations; Then above the generation of the class name we need to make a reference to our

Subsonic 3 SimpleRepository NON Plural Table names?

穿精又带淫゛_ 提交于 2019-12-20 05:01:54
问题 Is it possible to use SubSonic 3's Simple Repository with non-plural table names? My DB already exists, the table names a re singular add I cannot change them. 回答1: Nope, it is hardcoded in the SubSonic's source. You can pull it down and trace the migration steps to see where the plural happens. I know, cause I wanted the same thing. I was tinkering with modifying the source to make plurals optional via some parameter/config override or alike. But, I didn't get it completed (yet). 回答2: If

Subsonic 3 Linq Projection Issue

余生颓废 提交于 2019-12-20 04:24:25
问题 OK I'm banging my head against a wall with this one ;-) Given tables in my database called Address, Customer and CustomerType, I want to display combined summary information about the customer so I create a query to join these two tables and retrieve a specified result. var customers = (from c in tblCustomer.All() join address in tblAddress.All() on c.Address equals address.AddressId join type in tblCustomerType.All() on c.CustomerType equals type.CustomerTypeId select new CustomerSummaryView

subsonic 3 scaffolding

强颜欢笑 提交于 2019-12-20 02:52:09
问题 Are there the asp.net scaffolding controls (ex: < subsonic:QuickTable />) still available in subsonic 3? 回答1: No - we did that the best we could with 2.2 :) 回答2: Not Subsonic related, but Dynamic Data is something you might want to look into. Dynamic Data Information 回答3: There is no more scaffolding feature anymore. Subcommander also is abandoned. 来源: https://stackoverflow.com/questions/1082667/subsonic-3-scaffolding

Subsonic - can anyone provide an example of using Subsonic SimpleRepository to persist a list/array of objects?

梦想的初衷 提交于 2019-12-19 12:01:50
问题 I'm looking for possible ways to persist the following classes. Subsonic SimpleRepository looks like it might work, and people have said it should, when I asked a more general question. But I've been unable to find a single example of how to do this - or at least one I could understand. Can anyone point me to an example, or tell me how I could use Subsonic to map the following classes to a database? Note that I haven't designed the database - I'm hoping Subsonic will do that for me , lazy sod