subsonic3

SubSonic 3 and MySQL, removing underscore from column name in CleanUp() method causes exceptions when using property in linq-query

血红的双手。 提交于 2019-12-01 14:39:11
I've run into a problem when using SubSonic 3(.0.0.3) ActiveRecord with MySQL. Since MySQL doesn't allow you to use uppercase letters in table or column names (or rather disregards it if you do) I decided to separate words using underscores, e.g. entity_id, and then use the CleanUp() method to add title casing and remove the underscores. A friend wrote a ToTitleCase(string s) method that looks like this: string ToTitleCase(string s) { CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture; TextInfo textInfo = cultureInfo.TextInfo; return textInfo.ToTitleCase(s); } And the CleanUp()

Subsonic 3.0 and linq

两盒软妹~` 提交于 2019-12-01 08:40:55
I'm playing around with Subsonic 3.0 SimpleRepository and try to get menus and menuitems with one linq query, but the menuitems is allways null Menu public class Menu { public Menu() { MenuId = 0; MenuName = ""; MenuItems = null; } public int MenuId { get; set; } public string MenuName { get; set; } public MenuItem MenuItems { get; set; } } Menuitem public class MenuItem { public MenuItem() { MenuItemId = 0; MenuId = 0; MenuItemName = ""; } public int MenuItemId { get; set; } public int MenuId { get; set; } public string MenuItemName { get; set; } } Linq query var menus = from m in _repo.All

Subsonic 3.0 and linq

▼魔方 西西 提交于 2019-12-01 06:58:45
问题 I'm playing around with Subsonic 3.0 SimpleRepository and try to get menus and menuitems with one linq query, but the menuitems is allways null Menu public class Menu { public Menu() { MenuId = 0; MenuName = ""; MenuItems = null; } public int MenuId { get; set; } public string MenuName { get; set; } public MenuItem MenuItems { get; set; } } Menuitem public class MenuItem { public MenuItem() { MenuItemId = 0; MenuId = 0; MenuItemName = ""; } public int MenuItemId { get; set; } public int

SubSonic 3 Linq projecting anonymous types but not class types

て烟熏妆下的殇ゞ 提交于 2019-12-01 01:54:58
I am fairly new to SubSonic 3/Linq, and don't know if I'm missing something obvious, but I think I ran into a projection issue. I am trying to perform the most basic query, and getting back proper results only when I use anonymous types. The moment I swap the anonymous types with regular class types, I get all properties set to null/zero. I am crafting a DAL class library, so unfortunately anonymous types are not an option. Snippet using System; using System.Linq; using Fruits.Data; namespace FruitTest { class Program { static void Main(string[] args) { var db = new FruitsDB(); var fruits =

Subsonic 3 Save() then Update()?

混江龙づ霸主 提交于 2019-12-01 01:48:45
I need to get the primary key for a row and then insert it into one of the other columns in a string. So I've tried to do it something like this: newsObj = new news(); newsObj.name = "test" newsObj.Save(); newsObj.url = String.Format("blah.aspx?p={0}",newsObj.col_id); newsObj.Save(); But it doesn't treat it as the same data object so newsObj.col_id always comes back as a zero. Is there another way of doing this? I tried this on another page and to get it to work I had to set newsObj.SetIsLoaded(true); This is the actual block of code: page p; if (pageId > 0) p = new page(ps => ps.page_id ==

SubSonic 3 Linq projecting anonymous types but not class types

自作多情 提交于 2019-11-30 21:21:07
问题 I am fairly new to SubSonic 3/Linq, and don't know if I'm missing something obvious, but I think I ran into a projection issue. I am trying to perform the most basic query, and getting back proper results only when I use anonymous types. The moment I swap the anonymous types with regular class types, I get all properties set to null/zero. I am crafting a DAL class library, so unfortunately anonymous types are not an option. Snippet using System; using System.Linq; using Fruits.Data; namespace

Subsonic 3 - SimpleRepository

北慕城南 提交于 2019-11-28 09:27:00
I am playing around with Subsonic 3's simple repository and am hitting walls in understanding how to deal with foreign keys... If I have a product object containing int ID; string name; string description; Category category; int categoryID (this one is just to persist the product's categoryID to the DB) and a category object containing int ID; string name; How can I use the repository to bring back a list of all products with their category object instantiated? At the moment I have written a linq query which joins on product.categoryID = category.ID which is all well and good, but when I

Adding DataAnnontations to Generated Partial Classes

倖福魔咒の 提交于 2019-11-28 07:04:21
I have a Subsonic3 Active Record generated partial User class which I've extended on with some methods in a separate partial class. I would like to know if it is possible to add Data Annotations to the member properties on one partial class where it's declared on the other Subsonic Generated one I tried this. public partial class User { [DataType(DataType.EmailAddress, ErrorMessage = "Please enter an email address")] public string Email { get; set; } ... } That examples gives the "Member is already defined" error. I think I might have seen an example a while ago of what I'm trying to do with

Benchmark Linq2SQL, Subsonic2, Subsonic3 - Any other ideas to make them faster?

故事扮演 提交于 2019-11-27 03:57:20
问题 I am working with Subsonic 2 more than 3 years now... After Linq appears and then Subsonic 3, I start thinking about moving to the new Linq futures that are connected to sql. I must say that I start move and port my subsonic 2 with SubSonic 3, and very soon I discover that the speed was so slow thats I didn't believe it - and starts all that tests. Then I test Linq2Sql and see also a delay - compare it with Subsonic 2. My question here is, especial for the linq2sql, and the up-coming dotnet

Benchmark Linq2SQL, Subsonic2, Subsonic3 - Any other ideas to make them faster?

不羁的心 提交于 2019-11-26 19:08:51
I am working with Subsonic 2 more than 3 years now... After Linq appears and then Subsonic 3, I start thinking about moving to the new Linq futures that are connected to sql. I must say that I start move and port my subsonic 2 with SubSonic 3, and very soon I discover that the speed was so slow thats I didn't believe it - and starts all that tests. Then I test Linq2Sql and see also a delay - compare it with Subsonic 2. My question here is, especial for the linq2sql, and the up-coming dotnet version 4, what else can I do to speed it up ? What else on linq2sql settings, or classes, not on this