C# - Subsonic 3.0 And "Link" Tables?

Jan 23, 2010

I have the following set-up.

BlogPosts
BlogToCategory
Category

One blog post can have many categorys and a category can be in many blog posts. (Hence the intermediate table.

How would I go about getting a list of all the blog-posts in one category.

I've tried this but cant seem to get it right (I get a IQueryable -> IEnumerable cast error)

public IEnumerable<BlogPost> FetchAllBlogs(int? CatId)
{
return from c in CategoryLink.All()
where c.CategoryID == CatId
select c.BlogPost;
}

[Code]....

View 3 Replies


Similar Messages:

How To Link Two Tables With Same Fields In Different DB

Mar 25, 2011

I need to link two tables have the same fields but in different DB using visual studio 2010 and ASP.NET application? I'm using a grid view to show the details of each table.

View 1 Replies

C# - How To Use Subsonic 2.0

Mar 25, 2010

i try to use subsonic 3.0 but i can not do that. i decided to use subsonic.2.0. So i try to make it i can not :(

my Web Config :

[Code]....

also look this article: what is error? [URL]

View 1 Replies

To Set Subsonic Command Timeout?

Jun 23, 2010

Is there a way to set the command timeout for everything generated by subsonic?

View 1 Replies

Mvc - None Of The Generated Classes From Subsonic For Data Are Available

Jul 28, 2010

I have an MVC project setup, and I've brought the subsonic Active Record templates into my project, and they generated successfully and I can use the subsonic classes to access my database. However, how do I create a strongly typed view using the subsonic generated classes? When I select "add View" and I check the checkbox to create a strongly-typed view, none of the generated classes from subsonic for my data are available.

View 2 Replies

Concatenate Two Columns In Subsonic Datasource?

Mar 20, 2010

Does anyone know how I can concatenate two columns in my subsonic datasource? I want to display a first and last name in this dropdownlist but I don't want to put them in the same SQL column.

View 2 Replies

Changing The CreatedBy Convention In Subsonic (3x)?

Mar 7, 2011

I'm working against a database that wasn't designed by me and in all the tables there is a CreatedBy field that is an int. Now when I generate against this db i get all kinds of errors because subsonic is expecting that field to be a varchar.I don't particularly want to go and rename the field in all of these tables so I was hoping there was a way to "alter" or change the internal convention (without getting into the source) in subsonic.Has anyone been able/done this in subsonic 3.0.4??EDIT: I'm using the active record model in subsonic 3

View 1 Replies

Subsonic 2.2 Paging Linked Table Collection

Dec 26, 2010

I'm creating a small forum for my CMS and I'm using subsonic 2.2 as my DAL.
I'm loading my theads like this:

DAL.ForumThread item = DAL.ForumThread.FetchByID(id);

In my database my ForumPosts table looks like this:

ForumPostID | ThreadID | Description | UserID | CreatedOn| etc

So now when I have my DAL.ForumThread item I can load the connected post collection by using:

item.ForumPosts();

This all works great, but the problem is that I'm using serverside paging and want to add some additional select parameters too like showing only active records.

Is this even possible when using SubSonic 2.2 ? The workaround I have now is just creating a new SubSonic.Query and select the posts by threadid and there I can set pageindex and pagesize without problems but I think this can be done easier?

I also would like to know if it makes any difference performance wise by just using item.ForumPosts() or starting a new query, I think the forumposts are already in the ForumThreads collection and don't require a new database call right?

View 1 Replies

C# - SubSonic Active Record Generate Class?

Jul 6, 2010

i wanna use to subsonic 3.0.4 but i dont know, how can i start to generate class and use to new Template of T4. example: create new solution for generating to table's class and add to my project. ??

View 2 Replies

C# - Subsonic Delete With Fluent Query Tool?

Jan 4, 2011

In subsonic 2 we could do this:

public static void DeleteTable(SubSonic.TableSchema.Table table)
{
new Delete().From(table).Execute();
}

How can we do the same thing in v3? I can only seem to find documentation about using generics to target a specific table in the database...I want to be able to use it with a parameter as above.

View 2 Replies

Subsonic And Two DataText Columns In Dropdownlist Control?

Jul 8, 2010

Does anyone know how I can concatenate two columns in my subsonic datasource? I want to display a first and last name in this dropdownlist but I don't want to put them in the same SQL column.

View 2 Replies

C# - SubSonic .Paged() Query Returns Duplicate Records

Feb 8, 2011

Using a SubSonic (2.2) SqlQuery object, I am querying a view that contains distinct rows from another table. The results of the query, however, contain multiple rows for certain rows in the view. It appears to be because of a join on a temporary table in the query generated to achieve paging. How can I avoid this duplication of rows?

Bonus points: I have to use the view because SubSonic can't do .Paged() and .Distinct() at the same time. Why not?

View 1 Replies

C# - Errors When Creating Custom Querable Object With MVC And Subsonic Pagedlist

Jun 8, 2010

I have the following code but when i try and create a new IQuerable i get an error that the interface cannot be implemented, if i take away the new i get a not implemented exception, have had to jump back and work on some old ASP classic sites for past month and for the life of me i can not wake my brain up into C# mode. The code is to create a list of priceItems, but instead of a categoryID (int) i am going to be showing the name as string.

public ActionResult ViewPriceItems(int? page)
{
var crm = 0;
page = GetPage(page);
// try and create items2
IQueryable<ViewPriceItemsModel> items2 = new IQueryable<ViewPriceItemsModel>();
// the data to be paged,but unmodified
var olditems = PriceItem.All().OrderBy(x => x.PriceItemID);
foreach (var item in olditems)
{
// set category as the name not the ID for easier reading
items2.Concat(new [] {new ViewPriceItemsModel {ID = item.PriceItemID,
Name = item.PriceItem_Name,
Category = PriceCategory.SingleOrDefault(
x => x.PriceCategoryID == item.PriceItem_PriceCategory_ID).PriceCategory_Name,
Display = item.PriceItems_DisplayMethod}});
}
crm = olditems.Count() / MaxResultsPerPage;
ViewData["numtpages"] = crm;
ViewData["curtpage"] = page + 1;
// return a paged result set
return View(new PagedList<ViewPriceItemsModel>(items2, page ?? 0, MaxResultsPerPage));
}

View 2 Replies

C# - Subsonic 3.0.0.4 ActiveRecord Template For MySQL Error On Inserting New Record?

Nov 7, 2010

public void Add(IDataProvider provider){

var key=KeyValue();
if(key==null){
var newKey=_repo.Add(this,provider);
this.SetKeyValue(newKey);
}else{
_repo.Add(this,provider); //NullReferenceException was unhandled by user code

[Code]....

View 1 Replies

When Generate Against This Db Get All Kinds Of Errors Because Subsonic Is Expecting That Field To Be A Varchar?

Feb 14, 2011

I'm working against a database that wasn't designed by me and in all the tables there is a CreatedBy field that is an int. Now when I generate against this db i get all kinds of errors because subsonic is expecting that field to be a varchar.

I don't particularly want to go and rename the field in all of these tables so I was hoping there was a way to "alter" or change the internal convention (without getting into the source) in subsonic.

Has anyone been able/done this in subsonic 3.0.4??

EDIT: I'm using the active record model in subsonic 3

View 6 Replies

Databases :: Importing - Updating Sql Tables From Excel Sheet Into Multiple Tables Daily

Jan 4, 2011

I have an C# ASP application I am writing that needs to have the capability to import a generated excel or a comma delineated sheet each day. A clerk will have this job each morning so it doesn't need to be automated. My problem in trying to understand the solution to this is that the 1 sheet contains loan information, including customer information all in the same sheet. I would like to send certain columns to update information in the loan table and send other information to update the customer table. I need it to create relationships when new loans appear in the spreadsheet.

View 1 Replies

SQL Server :: How To Export The Data From Dat File To Tables(Two Tables)

Dec 30, 2010

I am using bulk insert concept to export the data from dat file to tables(Two tables). I am using the temporary table for to do the calculation and insertion to two tables. My problem is whenever I selecting the temp table data after the execution of bulk insertion , the order is changing .I need to get the order as it is in file order(csv,dat,txt).

View 5 Replies

Get The Tables Name And The Relation (dependency) Among The Tables?

Jul 24, 2010

I make use of SMO namaspace to get Table, Function, Procedure names from the DB.

Now I've intended to get the tables [Column] name and the relation (dependency) among the tables. Is this possible?

View 2 Replies

Link In Freetextbox Control/ Make Imagegallery Not Be Including This Link?

Nov 26, 2010

I use freetextbox control to rich text.When I insert an image with imagegalley it creates a link:

<A>http://www.freetextbox.com "target = _blank> FreeTextBox </ A>.

View 1 Replies

Web Forms :: Load A User Control On Link Click Event Of A Link Button During Postback Of Aspx Page?

Mar 2, 2011

Here is my requirement -

1. I need to load a user control on link click event of a link button during postback of aspx page.

2. On button click event of a save button on that aspx page, I need to read the selected values from that user control on further postback.

If I write the loadcontrol code in link_click event, the control is not recognized at all in the button_click event. When I shift it to page_init and execute only during not postback, the user control loads with default values.

View 1 Replies

Active Link And Visited Link Always Show The Same Color?

Feb 23, 2011

I have set link color as red and vlink as yellow and green color for alink but the color shown for links is always green for visted and active link?

View 5 Replies

Pdf Will Load If Use 'save Link As' But Not If User Clicks On The Link?

Jul 27, 2010

After submitting a form, the user is presented with a link to a pdf document. The link is straight to the document, it is not streamed.

If the user right-clicks and chooses 'save link as,' the document saves and opens fine. However, if the user just clicks on the link, the browser takes a very long time to respond (I'm going to guess it's 3 minutes) and then adobe reader gives the following error:

"the file is damaged and could not be repaired"

This is in Chrome v5, ASP.NET 3.5 and the link is returned inside an UpdatePanel.

View 2 Replies

Web Forms :: Create Link Thumbnails And Get Link Contents?

Apr 9, 2010

I want to create link thumbnails and get link contents like facebook in asp.net, but i couldn't find any resource.

View 1 Replies

Web Forms :: Why The 1st Link Cant Play Out After I Click The 2nd Link

Dec 28, 2010

For example, i browse the web page in browser, at first, i clink "home", home page is show out, then i click the "Contact us", then the "contact us" web page is showing out, BUT the problem is come out when i try to click the home page again, the home page doesn't come out and still at the contact us page...any1 know WHY?Thank you for helping...

View 4 Replies

Change The Title And Link Of The Last Link In Chain?

Jan 3, 2011

I have a SiteMapPath control and instead of default functionality like

Home > Accounts > User Account

where "User Account" refers to ~/UserAccount.aspx

I would like to overwrite the last node to show info about a current user, i.e.:

Home > Accounts > John White and "John White" refers to ~/UserAccount.aspx?id=111 ?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved