subsonic3

Object mapping with LINQ and SubSonic

≯℡__Kan透↙ 提交于 2019-12-04 21:29:47
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 } }; The ReleaseInfo object is a custom class and looks like this: public class ReleaseInfo { public

Defining SubSonic 3 ActiveRecord migrations

人盡茶涼 提交于 2019-12-04 19:52:56
I'm starting an ASP.NET MVC project using SubSonic 3 ActiveRecord. I added a table Users with a primary key ID and recompiled T4 files to generate User class. I want to make sure that, as I go along with the development, I can regenerate/migrate the database at any point. It looks like I have to create tables and relationships in the database, regenerating ActiveRecord classes and doing migration as described in http://subsonicproject.com/docs/3.0_Migrations . The old 2.x way of defining migrations doesn't seem to be available any more. Is there a way to drive development from the code rather

Linq and SubSonic - returning nested complex types

烂漫一生 提交于 2019-12-04 15:32:38
I'm new to SubSonic and reasonably new to LINQ as well, so I'm just trying to put a little app together. I've got the templates all sorted and running okay, but I've run into a bit of trouble with this LINQ statement (simplified slightly, the real statement has some other joins but they don't affect this particular problem so I've removed them for brevity): var addresses = from address in Database.Addresses.All() select new Address() { MyNestedType = new NestedType() { Field1 = address.ADDR1 } }; If I execute this statement I get the error Invalid cast from 'System.String' to 'NestedType'.

How to intersept the save method on ActiveRecord on SubSonic ORM?

时光怂恿深爱的人放手 提交于 2019-12-04 11:02:05
I need to intercept the Save method, do some validations, alter some properties and then let it go again normally. How can I do this? Thanks! Alex I would recommend adding the following partial methods to be fired before their actual action: OnSave(CancelEventArgs e); OnAdd(CancelEventArgs e); OnUpdate(CancelEventArgs e); OnDelete(CancelEventArgs e); This isn't an event but I would use CancelEventArgs anyway, it's friendly, people know it and know how to use it and with it the actual action can be canceled from the partial methods. These two should be added too to the list of the existing ones

Subsonic 3 VS Entity Framework

被刻印的时光 ゝ 提交于 2019-12-04 09:34:43
问题 Anyone worked with Subsonic3 and Entity Framework here who can tell me the pros and cons? This is my first time attempting to try these. Subsonic is easy to setup so as the Entity Framework. I am not sure if Entity Framework works with other databases as SubSonic does like MySql PGsql etc...? I read this post (http://www.timacheson.com/Blog/2009/jun/entity_framework_vs_subsonic) which is convincing enough to chose Entity Framework over SubSonic. But I wanted a second opening. 回答1: Well, these

Subsonic 3 LINQ Projection issue, fixed or no?

我与影子孤独终老i 提交于 2019-12-04 07:29:33
I'm currently experiencing the issue mentioned here (and several other places): Subsonic 3 Linq Projection Issue This is occurring using the 3.0.0.4 release package, and it also occurs when I grab the latest from GitHub and build it. I am using the LINQ Templates. I have this code: var newModel = new ViewModels.HomeIndexViewModel() { PulseListViewModel = new ViewModels.PulseListViewModel { Pulses = from p in _pulseQuery join a in _accountQuery on p.AccountId equals a.AccountId orderby p.CreateDate descending select new PulseListViewModel.Pulse() { AccountName = a.Name , Category = p.Category ,

SQL Views in SubSonic 3.0

与世无争的帅哥 提交于 2019-12-03 02:51:42
问题 Is there any way that I can access my SQL views in SubSonic 3.0? The code generation seems to skip views altogether 回答1: To include views in your project simply open SQLServer.ttinclude Find the query that load the tables ( search form 'const string TABLE_SQL') then change it to const string TABLE_SQL=@"SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' union select Table_catalog, table_schema, table_name, 'View' table_type from information_schema.views"; if you are using

Give an example of using subsonic 3

僤鯓⒐⒋嵵緔 提交于 2019-12-02 23:53:29
问题 Give me please an example on how to use subsonic 3 for: insert, select, update, delete, stored procedure usage. I am a new user of subsonic and dont know how to use it. Please explain it to me because I can not find the documentation about this. 回答1: Subsonic has great documentation including screencasts. Have a look: http://subsonicproject.com/docs/Main_Page 来源: https://stackoverflow.com/questions/6138243/give-an-example-of-using-subsonic-3

SubSonic3: Method “FirstOrDefault” throws exception with SQL Server 2000

▼魔方 西西 提交于 2019-12-02 20:08:26
问题 I am using SubSonic3 with SQL Server 2000. I have problem with the method "FirstOrDefault" - it always throws an exception = "Line 1: Incorrect syntax near '('." from the SubSonic.Linq dll EDIT (Added code from comment): InventoryDAL = DAL project name (dll) Inventort= Subsonic3 Gnerated classes Name space WHWarehouses = gnerated object Dim WareH = (From Wh In InventoryDAL.Inventort.WHWarehouses.All _ Where Wh.WarehouseID = 1 ).FirstOrDefault 回答1: I don't know SubSonic, but Hibernate has

SQL Views in SubSonic 3.0

坚强是说给别人听的谎言 提交于 2019-12-02 16:24:31
Is there any way that I can access my SQL views in SubSonic 3.0? The code generation seems to skip views altogether To include views in your project simply open SQLServer.ttinclude Find the query that load the tables ( search form 'const string TABLE_SQL') then change it to const string TABLE_SQL=@"SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' union select Table_catalog, table_schema, table_name, 'View' table_type from information_schema.views"; if you are using it in an asp.net project you can exclude the aspnet table and views like so const string TABLE_SQL=@"SELECT *