Search Results

Search found 8 results on 1 pages for 'user300992'.

Page 1/1 | 1 

  • Method 'SingleOrDefault' not supported by Linq to Entities

    - by user300992
    I read other posts on similar problem on using SingleOfDefault on Linq-To-Entity, some suggested using "First()" and some others suggested using "Extension" method to implement the Single(). This code throws exception: Movie movie = (from a in movies where a.MovieID == '12345' select a).SingleOrDefault(); If I convert the object query to a List using .ToList(), "SingleOrDefault()" actually works perfectly without throwing any error. My question is: Is it not good to convert to List? Is it going to be performance issue for more complicated queries? What does it get translated in SQL? Movie movie = (from a in movies.ToList() where a.MovieID == '12345' select a).SingleOrDefault();

    Read the article

  • Globalization for GetSystemTimeZones()

    - by user300992
    I want to get a list of timezones, so that i can populate the dropdown list. In .NET 3.5, we have TimeZoneInfo namespace, here is the code: ReadOnlyCollection<TimeZoneInfo> timeZones = TimeZoneInfo.GetSystemTimeZones(); foreach (TimeZoneInfo timeZone in timeZones) string name = timeZone.DisplayName However, "DisplayName" is in English. How can I pass the cultureInfo so that it can return other languages? I tried setting the Thread.CurrentCulture and CurrentUICulture, it didn't work. Am I missing something?

    Read the article

  • The specified type member 'EntityKey' is not supported in LINQ to Entities

    - by user300992
    I have 2 Entities "UserProfile" and "Agent", they are 1-many relationship. I want to do a query to get a list of Agents by giving the userProfileEntityKey. When I run it, I got this "The specified type member 'EntityKey' is not supported in LINQ to Entities" error. public IQueryable<Agent> GetAgentListByUserProfile(EntityKey userProfileEntityKey) { ObjectQuery<Agent> agentObjects = this.DataContext.AgentSet; IQueryable<Agent> resultQuery = (from p in agentObjects where p.UserProfile.EntityKey == userProfileEntityKey select p); return resultQuery; } So, what is the correct way to do this? Do I use p.UserProfile.UserId = UserId ? If that's the case, it's not conceptual anymore. Or should I write object query instead of LINQ query?

    Read the article

  • Entity LINQ on many-to-many got error "LINQ to Entities does not recognize the method 'Boolean Conta

    - by user300992
    I have 2 tables (Users and Roles) they are mapped as Many-to-Many in relational db. When I imported to Entity Data Content, they are still staying as the same relationship. Since they are mapped as Many-To-Many in Entity, I can access Users.RoleCollection or Roles.UserCollection However, when I execute this LINQ query, I got "LINQ to Entities does not recognize the method 'Boolean Contains... method, and this method cannot be translated into a store expression." var result (from a in Users from b in Roles where a.RoleCollection.Contains(b) select a); I think I must did something wrong... please help.

    Read the article

  • DotNetOpenAuth OpenIdTextBox For Google/Yahoo

    - by user300992
    If I want to integrate DotNetOpenAuth (primary for people to use their Google/Yahoo accounts to login, not act as provider) into my existing site, is this one line control good enough? <rp:OpenIdTextBox ID="OpenIdTextBox1" runat="server" /> Say, if a user wants to login as Google, I can simply set the textbox to "https://www.google.com/accounts/o8/id" and then they can login. I tried it with my Google account, it seems working and I can get the token from HttpContext.Current.User.Identity.Name. Is this "one line" solution secure enough for production? or is it a "must" that I have to use "OpenIdSelector" or "OpenIDLogin" control? I also opened the .net template and some samples, they are very complicated. There are PAPE policies, xrds.aspx (for discovery), ConsumerKey + ConsumerSecret...etc. As a newbie, I am very confused. Any tips on this will be really appreciated. Thanks

    Read the article

  • LINQ query checks for null

    - by user300992
    I have a userList, some users don't have a name (null). If I run the first LINQ query, I got an error saying "object reference not set to an instance of an object" error. var temp = (from a in userList where ((a.name == "john") && (a.name != null)) select a).ToList(); However, if I switch the order by putting the checking for null in front, then it works without throwing any error: var temp = (from a in userList where ((a.name != null) && (a.name == "john")) select a).ToList(); Why is that? If that's pure C# code (not LINQ), I think both would be the same. I don't have SQL profiler, I am just curious what will be the difference when they are being translated on SQL level.

    Read the article

  • DotNetOpenAuth Remember Me

    - by user300992
    I am using OpenIdLogin (with OpenIdButton) control on my login page, I noticed that there are properties "RememberMe", "RememberMeText" and "RememberMeVisible". However I can't get it to work, is there any example? Say, after the user logged on to my site successufully via Google, the user then decided to close the browser. If the user launch a new browser again, the user should not have to type the login/password again, right? Thanks for help

    Read the article

  • sp_executesql with 'IN' statement

    - by user300992
    I am trying to use sp_executesql to prevent SQL injection in SQL 2005, I have a simple query like this: SELECT * from table WHERE RegionCode in ('X101', 'B202') However, when I use sp_executesql to execute the following, it doesn't return anything. Set @Cmd = N'SELECT * FROM table WHERE RegionCode in (@P1)' SET @ParamDefinition = N'@P1 varchar(100)'; DECLARE @Code as nvarchar(100); SET @Code = 'X101,B202' EXECUTE sp_executesql @Cmd, @ParamDefinition, @P1 = @Code The is what I have tested: SET @Code = 'X101' <-- This works, it returns a single region SET @Code = 'X101,B202' <--- Returns nothing SET @Code = '''X101'',''B202''' <-- Returns nothing Please help.... what did I do wrong?

    Read the article

1