subsonic

With SubSonic is there a way to express relationships without foreign keys?

半世苍凉 提交于 2019-12-11 05:49:22
问题 Our database does not have foreign keys, but we wish to be able to use SubSonic. Are there any ways except for foreign keys to express relationships between tables? Also see this related question 回答1: There are three possible solutions that come to my mind: a) The hard way: Do everthing yourself Every class that is generated by SubSonic is a partial class. You can create a new file and add the properties methods for ForeignKey relation yourself: partial class Order { private

Update a primary key value using SubSonic 2.2

女生的网名这么多〃 提交于 2019-12-11 05:29:21
问题 I'm currently developing an app using SubSonic 2.2 and I'm having problems updating one of the columns of a composite PK on a table. My code is roughly this: foreach (pageItem page in pages) { page.IdFile = newIdFile; page.PageNumber = counter; counter++; page.Save(); } This does not update my record. My pageItem table contains 4 columns that make up the PK. I only need to update one of them to simulate that I'm moving a page object from one file to another, to avoid creating a new record

Subsonic in a VS2008 Add-In woes

六月ゝ 毕业季﹏ 提交于 2019-12-11 04:53:49
问题 I am writing a VS2008 add-in that connects to a remote database blah blah. I am having a problem with the app.config in this project. When I use SubSonic in my code, it moans that is cannot find the SubSonicServer section. This is because the .config file cannot be found. This appears to a problem with paths as the add-in is a DLL running in the context of VS2008 and the working directory is C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE. Is there a way to get the app.config to

Subsonic 2.2 Generated Property for SQL Server 2008 Date

耗尽温柔 提交于 2019-12-11 04:17:51
问题 Im using latest SVN 2.2 build compiled with VS 2008. When I build my VB classes using Sonic.exe any columns of type Date (Not Datetime ) are generated as "System.String". Has anybody else found this problem and have a solution or is this a problem with Subsonic? 回答1: Submit an issue here: http://code.google.com/p/subsonicproject/issues/list 回答2: It's still a pending issue, but it's an easy fix. If you have the SubSonic source code, make a few edits. -- src\SubSonic\DataProviders

Debug a Subsonic Select Query

余生长醉 提交于 2019-12-11 04:17:39
问题 I've got a Subsonic query that isn't returning any values. I think the problem is in my where clause, although I'm not sure why. What I'm really looking for is a way to debug the query to see the SQL that's actually being spit out by Subsonic. I know there was a way to do this with the Query object with Inspect(), but I'm using Select objects (or could also probably use SQLQuerys) because I need joins. Is there any inspect() type option for a Subsonic Select? Here's the code I'm using: Dim

Subsonic 3.0.0.3 Crash

戏子无情 提交于 2019-12-11 02:17:37
问题 Running the latest version of SubSonic (3.0.0.3). Retreiving a single record, making one field change and calling .Save results in a null reference exception in the code below: public void Update(IDataProvider provider){ if(this._dirtyColumns.Count>0) _repo.Update(this,provider); OnSaved(); } My code to create this exception is simply: DAL.MY_QUEUE l_l_itmEngageItem = MY__QUEUE.SingleOrDefault(x => x.id == each.id); l_l_itmItem.date_submitted = DateTime.Now; l_l_itmItem.Update(); Anyone have

Using MySQL GeoSpatial data types in .NET

谁说胖子不能爱 提交于 2019-12-11 01:30:03
问题 I'm looking for information on how to use MySQL geometry types in .NET. I'm using Sub-sonic for ORM and don't really need to support much more than MySQL's POINT type. The MySQL .NET connector seems to return point data as a byte[] array in the OpenGIS WKB format. What libraries are recommended for working with this WKB format? Alternatively, since I only need support for Point, examples on converting WKB to/from a .NET type would probably suffice. Assuming I can find (or build) a class that

Fixes for problems with SubSonic 3's TestRepository

我的梦境 提交于 2019-12-11 00:41:25
问题 I've been trying to use SubSonic 3.0's test repository support for unit testing but encountered a few issues, so I thought I document them, and the fixes I've come up with: Auto-Increment Columns Don't Work Obviously with no DB, auto-increment columns don't work automatically, but if like me you're using simple ints or longs for all identity columns, this fix works well: (This is a copy from here, included for completeness) In ActiveRecord.tt: 1: In the top of the function public void Add

PostgreSQL via subsonic

淺唱寂寞╮ 提交于 2019-12-11 00:29:51
问题 I try to work with my postgres DB via SubSonic. I have simple config: <configuration> <connectionStrings> <add name="test" connectionString="Server=localhost;Port=5432;User Id=iliy;Password=111;Database=test;" providerName="Npgsql"/> </connectionStrings> </configuration> But it does not work. I got "Unable to find the requested .Net Framework Data Provider. It may not be installed." There is Npgsql reference in project. What's wrong? 回答1: I think you need to dig a little deeper into Subsonic

Subsonic 3 Active Record TestRepository identity column not incremented

混江龙づ霸主 提交于 2019-12-10 12:14:47
问题 I am Unit Testing with Subsonic 3.0.0.3. Unit tests ran as expected with record count assertions passing. However the testing framework does not auto increment identity columns. For example var p1 = new Person() { Name = "Jack" }; p1.Add(); var p2 = new Person() { Name = "Jill" }; p2..Add(); var t1 = Person.SingleOrDefault(p => p.Name == "Jack"); var t2 = Person.SingleOrDefault(p => p.Name == "Jill"); Table structure read by the T4 template CREATE TABLE Person ( Id int IDENTITY(1,1) PRIMARY