subsonic3

Subsonic 3 ActiveRecord Test Feature Doesn't Support Linq?

淺唱寂寞╮ 提交于 2019-12-12 23:37:20
问题 According to this blog post, the ActiveRecord Test features in Subsonic 3 don't support linq. If this is true, it would seem to really constrain the usefulness of the Test features. Is there a workaround, or am I just misreading what was said? 回答1: I think you may be misreading as you can use LINQ with the ActiveRecord test Repository. Basically all SS does is mock up a repo with in memory List<> objects. 回答2: It looks like development and interest in SubSonic has dropped a lot with usable EF

How can I automate the t4 code generation for SubSonic

北城以北 提交于 2019-12-12 19:14:36
问题 I'm using SubSonic 3 (ActiveRecord mode) to generate the code for my DAL. It uses T4 templates (.tt) files that as soon as you save, generate the code for you. I want to automate this as part of my NANT build, but I can't get this to work. I know that MS provide a tool called TextTransform to generate the code from T4 templates, but in the case of the SubSonic templates this doesn't seem to work - I think the templates make some assumptions about the template being run from within Visual

subsonic unit testing bug?

痞子三分冷 提交于 2019-12-12 04:00:48
问题 I'm currently using Subsonic 3.03 Active Record repository. I have setup a Test connection string to utilise the dummy internal storage. [TestInitialize] public void TestInitialize() { List<ServiceJob> jobs = new List<ServiceJob>() { new ServiceJob() { ServiceJobID = 1 }, new ServiceJob() { ServiceJobID = 2 } }; ServiceJob.Setup(jobs); } [TestMethod] public void TestMethod() { ServiceJob job = ServiceJob.SingleOrDefault(s => s.ServiceJobID == 2); Assert.AreEqual(2, job.ServiceJobID); } I'm

SubSonic Bug with TOP keyword?

断了今生、忘了曾经 提交于 2019-12-12 02:22:49
问题 The TOP keyword in the generated SQL wraps the number in brackets (I persume for SQL compact support), however this errors on my SQL 2000 server as it doesn't expect the brackets. Example C# Code: var doc = Logic.Document.All().FirstOrDefault(d=> d.Guid == Request.QueryString["guid"]); Produces the following SQL error: Line 1: Incorrect syntax near '('. as it generates the following SQL: exec sp_executesql N'SELECT TOP (1) .....' If I execute the same SQL manually without the brackets the SQL

Casting problem in SubSonic 3

孤街浪徒 提交于 2019-12-12 01:42:31
问题 When saving a row that has a integere primary key following exception is thrown in the VB version: 'Public member 'ChangeTypeTo' on type 'Decimal' not found.' This happens in ActiveRecord.VB file line 3406: Public Sub SetKeyValue(value As Object) Implements IActiveRecord.SetKeyValue If value IsNot Nothing AndAlso value IsNot DBNull.Value Then Dim settable = value.ChangeTypeTo(Of Integer)() I can change the last line to: Dim settable = CInt(value) 'value.ChangeTypeTo(Of Integer)() This will

Subsonic 3: Invalid cast from 'System.Byte' to 'System.Byte[]'

早过忘川 提交于 2019-12-12 01:17:57
问题 I'm trying to use Subsonic 3.0 but with every query I try it gives me this error: "Invalid cast from 'System.Byte' to 'System.Byte[]'." I've tried using linq and activerecord on several different tables and always having this problem. Just to make sure, here is a code snipped that throws the error: LiteralContent.Text = DB.Teksten.SingleOrDefault(t => t.ID == Convert.ToInt32(TextID)).Tekst; Also try to debug into the error but couldn't find the exact source of the error while stepping through

Subsonic : Object of type 'System.UInt64' cannot be converted to type 'System.Int64'

我与影子孤独终老i 提交于 2019-12-11 22:20:22
问题 I just hooked up Subsonic to MySql for the first time. Everything seems to be cool except a simple: wp_1_post.All().ToList(); throws: Object of type 'System.UInt64' cannot be converted to type 'System.Int64'. It looks like the ID column in the wp_1_posts table is an unsigned bigint, just not sure what to do about it... 回答1: In MySQL.tt there is a check (GetSysType) which decides which type goes to which db type. At the moment we don't have a way to sense if something is unsigned (cause I don

Error with Subsonic attempting to convert Timespan to String

会有一股神秘感。 提交于 2019-12-11 15:23:48
问题 using Subsonic v3.0.0.3 with MS SQL 2008 (10.0.2531) and have two columns in a table 'Date' and 'Time' ( not DateTime columns) and when the ActiveRecord SingleOrDefault (line 14110) attempts to load the object (via a given pkid) this error is thrown; "Object of type 'System.TimeSpan' cannot be converted to type 'System.String'." Any idea on how to work around this? The part that fuzzles me is MS SQL doesn't have a 'Timespan' column type. 回答1: Date and Time column types are not currently

How to delete all records in a table using SubSonic 3

点点圈 提交于 2019-12-11 08:41:01
问题 I'm trying to delete all the records from a table using this approach: new Delete<Contact>().Execute(); This statement fails with a NullReferenceException in BuildDeleteStatement method at line: sb.Append(query.FromTables[0].QualifiedName); Because, although FromTables has one entry, it is set to null. I also tried this but it doesn't worked either: var provider = ProviderFactory.GetProvider("MonitorData"); new Delete<Contact>(provider).Execute(); What am I doing wrong? 回答1: You can do this

N Tiers with SubSonic 3, Dirty Columns collection is always empty on update

久未见 提交于 2019-12-11 08:18:23
问题 Here is what I am doing, and not working for me. I have a DAL generated with SubSonic 3 ActiveRecord template, I have a service layer (business layer if you well) that have mixture of facade and some validation. Say I have a method on the Service layer like public void UpdateClient(Client client); in my GUI i create a Client object fill it with some data with ID and pass it to the service method and this never worked, the dirty columns collection (that track which columns are altered in order