Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 2689127

@User 2689127
About
Posts
4
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How old were you when you first wrote a line of code ?
    U User 2689127

    About 10 on a TRS-80, trying to create my own versions of Adventure and Haunted House. From there, moved onto PIMS, their first database. :-D

    The Lounge question

  • How To Test If Linq Query Returned Results
    U User 2689127

    Thanks Gideon - I hadn't used Any for that purpose. Awesome tip!

    LINQ question csharp database linq tutorial

  • How To Test If Linq Query Returned Results
    U User 2689127

    Just reading this and thought I would jump in. I typically use query.FirstorDefault to verify it. You could also use query.Count>0 However, I tried some sample code and got that message when I hadn't instantiated my datacontext properly. That may not be it but just something to verify.

    LINQ question csharp database linq tutorial

  • Stupid Naming Consequences with LINQ
    U User 2689127

    Here's another good reason not to use reserved names. I'm working on a LINQ project with a series of tables that manage user roles. As a result, I have table names like Systems, Roles and Users. My trouble started when I would add the objects to the Designer, hit Save and then suddenly Visual Studio would say things like System.Data.Linq.Mapping.DatabaseAttribute is not defined or System.Nullable is not defined In short, stopping me dead in my tracks. Now that I look back, I don't know why I didn't see the reason earlier. When using the Object Relational Designer, Visual Studio wants to be smart and changes any words that are plural to singular so they make more sense when dealing with data. That way, your code looks like oUser = New User oUser.UserName = "John" instead of oUser = New Users This is really nice because it does make the code a little more legible except in this situation: Plural (singular) Users (User) Roles (Role) UserRoles (UserRole) Systems (System) See the gotcha? Visual Studio translated the "Systems" table into a "System" object which immediately negated all of the main namespaces in the project. The renaming feature for the objects in LINQ-to-SQL is great - but be warned, when you start getting errors like this, take a look at your source tables.

    The Weird and The Wonderful csharp database visual-studio linq question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups