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
  1. Home
  2. General Programming
  3. LINQ
  4. Object adding itself ...

Object adding itself ...

Scheduled Pinned Locked Moved LINQ
questionannouncement
13 Posts 4 Posters 32 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jammer 0
    wrote on last edited by
    #1

    Hi All, I've created an object that inherits from a type in my datacontext which I am then trying to add using this method:

        /// /// Saves the new or updated catalog entry
        /// 
        public void SaveEntry()
        {
            if (\_isNewEntry)
            {
                \_context.ListOfSampleCatelogs.InsertOnSubmit(this);
                \_context.SubmitChanges();
                \_context.Dispose();
            }
            else
            {
                \_context.SubmitChanges();
                \_context.Dispose();
            }
        }
    

    Is this pure insanity on my part or is this actually doable? I've spend most of the evening working on this and haven't made any progress or found anyone on the web doing something similar. I also check for an existing record as I either want to update an existing record or add this as a new one ... hmm ... Thanks in advance ...

    Jammer Going where everyone here has gone before! :) My Blog

    P 1 Reply Last reply
    0
    • J Jammer 0

      Hi All, I've created an object that inherits from a type in my datacontext which I am then trying to add using this method:

          /// /// Saves the new or updated catalog entry
          /// 
          public void SaveEntry()
          {
              if (\_isNewEntry)
              {
                  \_context.ListOfSampleCatelogs.InsertOnSubmit(this);
                  \_context.SubmitChanges();
                  \_context.Dispose();
              }
              else
              {
                  \_context.SubmitChanges();
                  \_context.Dispose();
              }
          }
      

      Is this pure insanity on my part or is this actually doable? I've spend most of the evening working on this and haven't made any progress or found anyone on the web doing something similar. I also check for an existing record as I either want to update an existing record or add this as a new one ... hmm ... Thanks in advance ...

      Jammer Going where everyone here has gone before! :) My Blog

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      I'll send you some code next week - we use a variation on this pattern.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      J 1 Reply Last reply
      0
      • P Pete OHanlon

        I'll send you some code next week - we use a variation on this pattern.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        J Offline
        J Offline
        Jammer 0
        wrote on last edited by
        #3

        Pete, I really do owe you one already!!! Seeing what you use would be so appreciated chap! Cheers,

        Jammer Going where everyone here has gone before! :) My Blog

        P 1 Reply Last reply
        0
        • J Jammer 0

          Pete, I really do owe you one already!!! Seeing what you use would be so appreciated chap! Cheers,

          Jammer Going where everyone here has gone before! :) My Blog

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Send me an email so that I know where to send the zip to. Just click the Email link in the thread, and send me your address so that it's kept private.

          Deja View - the feeling that you've seen this post before.

          My blog | My articles

          G 1 Reply Last reply
          0
          • P Pete OHanlon

            Send me an email so that I know where to send the zip to. Just click the Email link in the thread, and send me your address so that it's kept private.

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            G Offline
            G Offline
            Giorgi Dalakishvili
            wrote on last edited by
            #5

            Can I send you my e-mail too?

            Giorgi Dalakishvili #region signature my articles #endregion

            P 1 Reply Last reply
            0
            • G Giorgi Dalakishvili

              Can I send you my e-mail too?

              Giorgi Dalakishvili #region signature my articles #endregion

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              Sure, why not - if you're interested in this project then feel free.

              Deja View - the feeling that you've seen this post before.

              My blog | My articles

              N 1 Reply Last reply
              0
              • P Pete OHanlon

                Sure, why not - if you're interested in this project then feel free.

                Deja View - the feeling that you've seen this post before.

                My blog | My articles

                N Offline
                N Offline
                N a v a n e e t h
                wrote on last edited by
                #7

                I have emailed you. If you don't mind, please CC to me also. I am interested in the pattern which you said.

                All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

                P 1 Reply Last reply
                0
                • N N a v a n e e t h

                  I have emailed you. If you don't mind, please CC to me also. I am interested in the pattern which you said.

                  All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  I didn't think it would be as interesting.:) Anyhoo - when your email address comes through, I'll add it to the list.

                  Deja View - the feeling that you've seen this post before.

                  My blog | My articles

                  G 1 Reply Last reply
                  0
                  • P Pete OHanlon

                    I didn't think it would be as interesting.:) Anyhoo - when your email address comes through, I'll add it to the list.

                    Deja View - the feeling that you've seen this post before.

                    My blog | My articles

                    G Offline
                    G Offline
                    Giorgi Dalakishvili
                    wrote on last edited by
                    #9

                    I've just sent it. What about writing about an article?

                    Giorgi Dalakishvili #region signature my articles #endregion

                    P 1 Reply Last reply
                    0
                    • G Giorgi Dalakishvili

                      I've just sent it. What about writing about an article?

                      Giorgi Dalakishvili #region signature my articles #endregion

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #10

                      Giorgi Dalakishvili wrote:

                      What about writing about an article?

                      Tell you what - see what you think when you get the code, and then let me know if you think I should.

                      Deja View - the feeling that you've seen this post before.

                      My blog | My articles

                      G 1 Reply Last reply
                      0
                      • P Pete OHanlon

                        Giorgi Dalakishvili wrote:

                        What about writing about an article?

                        Tell you what - see what you think when you get the code, and then let me know if you think I should.

                        Deja View - the feeling that you've seen this post before.

                        My blog | My articles

                        G Offline
                        G Offline
                        Giorgi Dalakishvili
                        wrote on last edited by
                        #11

                        Waiting for the code then.

                        Pete O'Hanlon wrote:

                        Tell you what - see what you think when you get the code, and then let me know if you think I should.

                        I suspect it's just several lines of code. Something like a snippet.

                        Giorgi Dalakishvili #region signature my articles #endregion

                        P 2 Replies Last reply
                        0
                        • G Giorgi Dalakishvili

                          Waiting for the code then.

                          Pete O'Hanlon wrote:

                          Tell you what - see what you think when you get the code, and then let me know if you think I should.

                          I suspect it's just several lines of code. Something like a snippet.

                          Giorgi Dalakishvili #region signature my articles #endregion

                          P Offline
                          P Offline
                          Pete OHanlon
                          wrote on last edited by
                          #12

                          Giorgi Dalakishvili wrote:

                          I suspect it's just several lines of code. Something like a snippet.

                          There are certainly several lines of code in it.;P No - it'll take me a little while to sanitize our company specific bits of code in it. It's a combination of custom DataContext and Business Object layer. It's going to take me a little while to change it over to run with a database like Northwind.

                          Deja View - the feeling that you've seen this post before.

                          My blog | My articles

                          1 Reply Last reply
                          0
                          • G Giorgi Dalakishvili

                            Waiting for the code then.

                            Pete O'Hanlon wrote:

                            Tell you what - see what you think when you get the code, and then let me know if you think I should.

                            I suspect it's just several lines of code. Something like a snippet.

                            Giorgi Dalakishvili #region signature my articles #endregion

                            P Offline
                            P Offline
                            Pete OHanlon
                            wrote on last edited by
                            #13

                            Right, I've got Jammer's, Navaneeth's and your email addresses now. When I'm finished I'll send it on to you.

                            Deja View - the feeling that you've seen this post before.

                            My blog | My articles

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

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