Click here to Skip to main content
15,890,512 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Solar Azimuth Angle Pin
OriginalGriff27-Nov-20 21:30
mveOriginalGriff27-Nov-20 21:30 
GeneralRe: Solar Azimuth Angle Pin
Richard MacCutchan27-Nov-20 22:25
mveRichard MacCutchan27-Nov-20 22:25 
GeneralRe: Solar Azimuth Angle Pin
Gerry Schmitz28-Nov-20 7:22
mveGerry Schmitz28-Nov-20 7:22 
GeneralRe: Solar Azimuth Angle Pin
Chris C-B29-Nov-20 1:46
Chris C-B29-Nov-20 1:46 
GeneralGeek Squad tries to fix problem remotely, ends up hosing the system completely, requiring bringing the desktop into the office! Pin
swampwiz27-Nov-20 15:41
swampwiz27-Nov-20 15:41 
GeneralRe: Geek Squad tries to fix problem remotely, ends up hosing the system completely, requiring bringing the desktop into the office! Pin
Richard MacCutchan27-Nov-20 22:23
mveRichard MacCutchan27-Nov-20 22:23 
GeneralRe: Geek Squad tries to fix problem remotely, ends up hosing the system completely, requiring bringing the desktop into the office! Pin
swampwiz28-Nov-20 18:59
swampwiz28-Nov-20 18:59 
GeneralNever Let A Opportunity Go to Waste Pin
#realJSOP27-Nov-20 8:24
mve#realJSOP27-Nov-20 8:24 
I found myself with nothing to do this week, so I decided to make a concerted effort to repair the significant code loss I suffered back in May/2020 with respect to my entity factory app. I think I'm happy once again with the model generation, so I figured I'd post some code the app generated for me.

For those that have forgotten, EntityFactory will generate model (and optionally viewmodel) classes based on the selected table, view, and stored procedure (SQL server). What makes this app more functional than the ADO code generator is that it will generate an object for any stored proc that returns data, regardless of the method by which the data is returned (the ADO code generator refuses to work with stored procs that return data with dynamic sql, and re-generating code doesn't work in a number of spectacular ways). In the sample below, I turned on the generation of crud properties, just to exercise that part of the code. All of the code below was generated based on the returned schema for the indicated database source object. Processing took less than a second.

C#
/==================================================================================================
// Source object: AEF2.dbo.Alerts (table)
// File generated: 2020.11.27, 01:03:07

// This file was generated by EntityFactory. Do not modify this file. When regenerated, the file    
// may be overwritten if it already exists (and EntityFactory was configured to overwrite existing   
// files). Note that the generated class is "partial", so if you need to augment the generated    
// code, create a new partial extension file and put your custom code in that new file.             

// The class name indicates the model (or viewmodel) class name prefix followed by the name of the  
// original database object from which the class was generated.                                     
//==================================================================================================

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

// Auto-incrementing column detected - added the following using to support standard C# attributes.
// If you haven't already, add a reference to System.ComponentModel.DataAnnotations to the 
// applicable assembly in your application.
using System.ComponentModel.DataAnnotations;

namespace Models
{
    public partial class EntityAlerts
    {
        #region entity properties

        [Key]
        public int      ID               { get; set; }
        public string   AlertName        { get; set; }
        public string   AlertTitle       { get; set; }
        public string   AlertMsg         { get; set; }
        public DateTime AlertStartDate   { get; set; }
        public DateTime AlertExpireDate  { get; set; }
        public int      AlertType        { get; set; }
        public int      AlertClassLevel  { get; set; }
        public string   AlertApps        { get; set; }
        public string   ActionName       { get; set; }
        public string   ControllerName   { get; set; }
        public DateTime DateAdded        { get; set; }
        public int      AddedByUMSUserID { get; set; }

        #endregion entity properties


        #region database properties

        public string CRUDGet
        {
            get
            {
                return "SELECT [ID], [AlertName], [AlertTitle], [AlertMsg], [AlertStartDate],"
                        +" [AlertExpireDate], [AlertType], [AlertClassLevel], [AlertApps], [ActionName],"
                        +" [ControllerName], [DateAdded], [AddedByUMSUserID] FROM [dbo].[Alerts]"
                        +" WITH(NOLOCK);";
            }
        }

        public string CRUDUpsert
        {
            get
            {
                return "UPDATE [dbo].[Alerts] SET [AlertName] = @AlertName , [AlertTitle] ="
                        +" @AlertTitle , [AlertMsg] = @AlertMsg , [AlertStartDate] = @AlertStartDate ,"
                        +" [AlertExpireDate] = @AlertExpireDate , [AlertType] = @AlertType ,"
                        +" [AlertClassLevel] = @AlertClassLevel , [AlertApps] = @AlertApps , [ActionName]"
                        +" = @ActionName , [ControllerName] = @ControllerName , [DateAdded] = @DateAdded"
                        +" , [AddedByUMSUserID] = @AddedByUMSUserID WHERE [ID] = @ID;"
                        +" IF @@ROWCOUNT = 0"
                        +" INSERT INTO [dbo].[Alerts] ( [AlertName] , [AlertTitle] , [AlertMsg] ,"
                        +" [AlertStartDate] , [AlertExpireDate] , [AlertType] , [AlertClassLevel] ,"
                        +" [AlertApps] , [ActionName] , [ControllerName] , [DateAdded] ,"
                        +" [AddedByUMSUserID]) VALUES ( @AlertName , @AlertTitle , @AlertMsg ,"
                        +" @AlertStartDate , @AlertExpireDate , @AlertType , @AlertClassLevel ,"
                        +" @AlertApps , @ActionName , @ControllerName , @DateAdded , @AddedByUMSUserID);";
            }
        }

        public string CRUDDelete
        {
            get
            {
                return "DELETE FROM [dbo].[Alerts] WHERE [ID] = @ID;";
            }
        }


        #endregion database properties

    }

}

".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

GeneralRe: Never Let A Opportunity Go to Waste Pin
RickZeeland27-Nov-20 9:01
mveRickZeeland27-Nov-20 9:01 
GeneralRe: Never Let A Opportunity Go to Waste Pin
#realJSOP27-Nov-20 9:25
mve#realJSOP27-Nov-20 9:25 
GeneralRe: Never Let A Opportunity Go to Waste Pin
RickZeeland27-Nov-20 9:41
mveRickZeeland27-Nov-20 9:41 
GeneralRe: Never Let A Opportunity Go to Waste Pin
#realJSOP27-Nov-20 9:49
mve#realJSOP27-Nov-20 9:49 
GeneralRe: Never Let A Opportunity Go to Waste Pin
honey the codewitch27-Nov-20 10:21
mvahoney the codewitch27-Nov-20 10:21 
GeneralRe: Never Let A Opportunity Go to Waste Pin
RickZeeland27-Nov-20 18:29
mveRickZeeland27-Nov-20 18:29 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Sander Rossel28-Nov-20 0:46
professionalSander Rossel28-Nov-20 0:46 
GeneralRe: Never Let A Opportunity Go to Waste Pin
#realJSOP28-Nov-20 6:19
mve#realJSOP28-Nov-20 6:19 
GeneralRe: Never Let A Opportunity Go to Waste Pin
honey the codewitch28-Nov-20 6:24
mvahoney the codewitch28-Nov-20 6:24 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Mycroft Holmes28-Nov-20 10:17
professionalMycroft Holmes28-Nov-20 10:17 
GeneralRe: Never Let A Opportunity Go to Waste Pin
honey the codewitch28-Nov-20 10:21
mvahoney the codewitch28-Nov-20 10:21 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Amarnath S27-Nov-20 13:40
professionalAmarnath S27-Nov-20 13:40 
GeneralRe: Never Let A Opportunity Go to Waste Pin
#realJSOP27-Nov-20 22:16
mve#realJSOP27-Nov-20 22:16 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Sander Rossel28-Nov-20 0:55
professionalSander Rossel28-Nov-20 0:55 
GeneralRe: Never Let A Opportunity Go to Waste Pin
#realJSOP28-Nov-20 6:31
mve#realJSOP28-Nov-20 6:31 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Sander Rossel28-Nov-20 8:32
professionalSander Rossel28-Nov-20 8:32 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Kelly Herald1-Dec-20 7:15
Kelly Herald1-Dec-20 7:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.