C# - Extend DynamicQuery.cs To Implement A .Single Method?

Mar 28, 2010

I need to write some dynamic queries for a project I'm working on. I'm finding out that a significant amount of time is being spent by my program on the Count and First methods, so I started to change to .Single, only to find out that there is no such method.

The code below was my first attempt at creating one (mostly copied from the Where method), but it's not working.

public static object Single(this IQueryable source, string predicate, params object[] values)
{
if (source == null) throw new ArgumentNullException("source");
if (predicate == null) throw new ArgumentNullException("predicate");
LambdaExpression lambda = DynamicExpression.ParseLambda(source.ElementType, typeof(bool), predicate, values);
return source.Provider.CreateQuery(
Expression.Call(
typeof(Queryable), "Single",
new Type[] { source.ElementType },
source.Expression, Expression.Quote(lambda)));
}

View 3 Replies


Similar Messages:

MVC :: How To Extend Controller With Extension Method Which Redirects To 404 Page

Sep 28, 2010

I am trying to extend controller with extension method which redirects to 404 page.

[Code]....

However, controller.View() method is internal and can't be called outside class methods.

View 3 Replies

Security :: SSO / How To Implement Single Sign

May 4, 2010

How to implement Single sign on in asp.net web application.

Give me to full tutorial. How to implement this in two apps.

View 3 Replies

Php - Implement Single Sign On With SubDomains?

Feb 4, 2010

I would like to know how to implement Single Sign On across subdomains running on a mixture of programming platforms, asp.net and php?

View 1 Replies

Security :: Implement Single Sign-On Using Membership API?

Apr 7, 2010

I am working as a trainee in a software company.

I want to implement Single Sign-On in two different applications(different domains).

View 2 Replies

Web Forms :: Implement Single SignOn In Subdomains

Oct 21, 2015

I am planning to have 2 subdmains on my IIS server. Example - [URL]. So if someone logs on Portal and if we clicks on the App link, he should be successfully logged into App.

SO basically 1 signin for both subdomains. How to achieve it in ASP.Net 4, C#, VS.Net 2013?

View 1 Replies

Security :: Implement Cookieless Single Sign-on Across Many Domains?

Feb 16, 2011

im using visual studio 2008. my requirement is to implement single sign on across many domains without using cookies. is this possible? for example, i have 3 domains (hosted in 3 different systems). www.domain1.com www.domain2.com www.domain3.com and cookies are disabled. i implemented single sign on with cookies, if the sites are hosted in single system then it is working. but it doesnt work if cookies are disabled. i tried all made all possible google searches, but couldnt find anything useful.

View 5 Replies

Web Forms :: Implement Single Sign On Application Functionality

Dec 7, 2013

I am going to create application, in that application, i need feature of single sign on application.if i am login with 1 application, i suppose to login with others application.ex. if i login in gmail, then i automatically login with You Tube...

View 1 Replies

How To Implement Save To Csv Method

Aug 27, 2010

I have customer data saved into my database. when the customer access this data through his login and if clicks save to csv, the data has to be saved into their local machine. I am using asp.net version 1.1 and VS2003.

View 2 Replies

MVC :: Implement OnValidate Method?

Feb 4, 2011

I'm using MVC 2 with entity framework. How do I implement OnValidate method? If it is not in mvc 2, what is the alternate?

View 5 Replies

C# - How To Implement Multiple Login/logout-domains, Single Main Domain In Forms Authentication

Jan 25, 2011

i want to have several domains A, B, C where a user can enter his username and password to login to a common main domain D.

So the user goes to A, B or C, enters his username and password, clicks the "login" button, and is then on the main domain D in a logged in/authenticated state. Then the user does the things he wants to do, and then clicks the logout-button and is then returned to the original domain that he came from, be it A, B or C.

What is the best way to do this?

I currently use forms authentication in ASP.NET 4.0 (C#).

View 1 Replies

MVC :: Extend The HtmlHelper By Using Metadata / Access Metadata In HtmlHelper Extension Method?

Jan 9, 2010

I would like to extend the HtmlHelper by using metadata (similar to DataAnnotaions metadata). Specifically I want to be able to add a 'Title' attribute to html controls that will then appear as a tooltip on the control. I would like to keep the tooltip text with my model, for example by adding 'Tiltle' metadata to the model as follows:

[DisplayName("User Id")]
[Title("Enter your 10 digit user id")]
property UserId { get; set; }

So the questions are:

1. How do I add metadata (such as 'Title') to my model?

2. How do I access this metadata in my HtmlHelper extension method?

[code]....

View 4 Replies

MVC :: Implement A Controller Method That Does Not Have A View

Dec 29, 2010

i have created a controller method that just update a record in the database.

and i call this method using the following code

<%
: Html.ActionLink("Perform
Calculation",
"Calculate")%>

but the problem is that when i click on the Perform Link an error will be raised indicating that it can not find the Calculate view.

so how i can enforce my application to call the Calculate controller method to perform the update and to keep the user in the current page .(the index page).

View 8 Replies

MVC2 Does Every Single Controller Method Have To Map To A DIFFERENT View?

Sep 16, 2010

In MVC2 does every single controller method have to map to a DIFFERENT view?Or can I make two methods map to the same view?

View 3 Replies

Implement Jquery Plugin Add Method Validation

Mar 15, 2010

I have a problem to use jquery Plugin/Validation.I want to add a method and follow the documentation but I think I still missing some thing.First I add the method but I think I have a problem to implement it.

<script src="js/jquery-1.4.1.js" type="text/javascript"></script>

<script src="js/jquery.validate.js" type="text/javascript"></script>

[code]....

View 1 Replies

AJAX :: TabContainer - Implement New Method Tabchanging

Jan 3, 2011

I would like to know how hard is implement a new event on this control. my question is because for the moment the property OnClientActiveTabChanged is not working well for me (for some reason the controls'values inside of the tabpanel are lost.- the problems is just with a customizable control) it's hard?

View 1 Replies

JQuery :: How To Validate A Textboxes Using Single Javascript Method

Jul 24, 2010

i am working on asp.net, for example in a form they are 10 text boxes i want to validate each textbox if it is empty it should display a alert message.

how to achieve this by using a single javasript method. can we pass texbox as an argument into javascript how to achieve this

View 5 Replies

SQL Reporting :: Using ReportViewer.LocalReport.Render() Method To Export Single Report Multiple Times?

Oct 21, 2010

I'm using the ReportViewer control on my .aspx page which displays a single report based on various user parameter selections. Dropdown2 is dependent on the DropDown1 selection (i.e. the user selects Unit A from DropDown1 and that results in 10 selections under Dropdown2, or the user selects Unit B from DropDown1 and that results in 15 selections under DropDown2, and so on). The user makes the selections, clicks the "Run Report" button, and the report displays as expected. The user then can export to Excel or PDF

I've received a request to allow users to run the report for all possible selections and export to their desired format rather than having to run the report for each separate DropDown1 and DropDown2 selection. So in other words, they don't even want to see the report on the screen, they just want to be able to click a button that runs the report for all possible parameter selections and export it to a single Excel or PDF document.

View 1 Replies

Forms Data Controls :: Using Multiple Tables Within A Single DataSet And Single SqlDataSource?

May 19, 2010

I have a stored procedure that returns 3 tables within the single recordset it returns. If I set a SqlDataSource to get data from this procedure, it works, but it only returns the first table. I want to have a GridView display the data from the 2nd or 3rd table using a SqlDataSource, but I can't figure out how to specify a particular table.

While there are some posts discussing this out there, I can't get a definitive answer about whether or not this is even possible (?). In a worst-case scenario, I can create another SP that only returns the 3rd table - but that creates a little maintenance headache that I would prefer to avoid.

View 4 Replies

DataSource Controls :: Using LINQ To Pull Out A Single Value From A Single Result Row Of A Join Query?

May 25, 2010

For context: First of all, I am new to LINQ, as I have been using SubSonic for quite some time now.

I have two tables, Users, and Affiliates. They both have a very typical schema. The FK that joins them is the UserId field, which is in the Affiliates table. I want to create a LINQ query that pulls the Username from the Users table using the AffiliateId value. The AffiliateId is a primary key of the Affiliates table.

I have tried to accomplish this using many variations of the following code:

[Code]....

In the above query, I expect to get a single row result set. However, I instead receive the entire table of results.

How can I make this work? I have yet to see an example or article out there to do what I am trying to do.

View 9 Replies

Open A Single Worksheet (single Tab) From A Huge Excel File On A Web Browser Using C#

Feb 27, 2010

I have huge excel files that I have to open from web browser. It takes several minutes to load huge file. Is it possible to open a single worksheet (single tab) at a time from excel file that contains many worksheets? I have to do this using C# / asp.net MVC

View 5 Replies

Web Forms :: Disable A Single Intem In Dropdownlist Or Stop The Ddl Change Event For A Single Item?

Sep 20, 2010

I am trying something apart of my boundries, is there any way to disable a single intem in dropdownlist or stop the ddl change event for a single item.

View 2 Replies

Inheritance - Extend Whole Website In Asp?

Mar 10, 2011

I work in a web agency and thus we are plenty of websites from several customers. They're built upon a cms we made, so websites are quite identical for the 90% of code. However, remaining 10% struggles me and my team as it involves not only the presentation layer but behavioral logics too (ex: a website1 requires simply user/pass registration while website2 needs more data, facebook connector, etc. But this is a very easy example). Making ad hoc development for our customers is becoming painful as keep each version aligned is getting really hard for us What I really dream to have is an extendible website that works by itself, but in which I can override a part. This behavior should sound like "look for the specific part, if it doesn't exists get the base one". The parts could be a method, a class, a page, a control, a static file.

example:
Suppose I want website2 to have an own login component, let's so imagine that we have a situation like:

/website_base
|_ login.aspx
/website1
/website2
|_ login.aspx

So, if I ask for [URL] I'll get /website_base/login.aspx, but if I ask for [URL] I'll get /website2/login.aspx

View 3 Replies

Web Forms :: How To Extend Web User Control

Aug 12, 2010

i have a WebUserControls with 2 file : UCTMyControl.ASCX and UCTMyControl.ASCX.CS

In file UCTMyControl.ASCX.CS i have 1 virtual method Example: Virtual void Hello();

and now in Page example : MyPage.aspx and MyPage.aspx.cs

i want override method Hello() above in Web User Controls

how can i do ?

View 2 Replies

C# - How To Extend The User.Identity Property

Jul 30, 2010

I'm not talking about asp.net membership.

For each logged user I want to cache some properties like status or the number of friend requests, from the db.

I can create custom class which would do it but I thought it will be better to extend the existing User.Identity property. Something like this:

Label1.Text = User.Identity.Status;

View 2 Replies







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