Click here to Skip to main content
14,741,744 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 22:30
mveOriginalGriff27-Nov-20 22:30 
GeneralRe: Solar Azimuth Angle Pin
Richard MacCutchan27-Nov-20 23:25
mveRichard MacCutchan27-Nov-20 23:25 
GeneralRe: Solar Azimuth Angle Pin
Gerry Schmitz28-Nov-20 8:22
mveGerry Schmitz28-Nov-20 8:22 
GeneralRe: Solar Azimuth Angle Pin
Chris C-B29-Nov-20 2:46
MemberChris C-B29-Nov-20 2: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 16:41
Memberswampwiz27-Nov-20 16: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 23:23
mveRichard MacCutchan27-Nov-20 23: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 19:59
Memberswampwiz28-Nov-20 19:59 
GeneralNever Let A Opportunity Go to Waste Pin
#realJSOP27-Nov-20 9:24
mva#realJSOP27-Nov-20 9: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.

/==================================================================================================
// 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 10:01
mveRickZeeland27-Nov-20 10:01 
GeneralRe: Never Let A Opportunity Go to Waste Pin
#realJSOP27-Nov-20 10:25
mva#realJSOP27-Nov-20 10:25 
GeneralRe: Never Let A Opportunity Go to Waste Pin
RickZeeland27-Nov-20 10:41
mveRickZeeland27-Nov-20 10:41 
GeneralRe: Never Let A Opportunity Go to Waste Pin
#realJSOP27-Nov-20 10:49
mva#realJSOP27-Nov-20 10:49 
GeneralRe: Never Let A Opportunity Go to Waste Pin
honey the codewitch27-Nov-20 11:21
mvahoney the codewitch27-Nov-20 11:21 
GeneralRe: Never Let A Opportunity Go to Waste Pin
RickZeeland27-Nov-20 19:29
mveRickZeeland27-Nov-20 19:29 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Sander Rossel28-Nov-20 1:46
professionalSander Rossel28-Nov-20 1:46 
GeneralRe: Never Let A Opportunity Go to Waste Pin
#realJSOP28-Nov-20 7:19
mva#realJSOP28-Nov-20 7:19 
GeneralRe: Never Let A Opportunity Go to Waste Pin
honey the codewitch28-Nov-20 7:24
mvahoney the codewitch28-Nov-20 7:24 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Mycroft Holmes28-Nov-20 11:17
professionalMycroft Holmes28-Nov-20 11:17 
GeneralRe: Never Let A Opportunity Go to Waste Pin
honey the codewitch28-Nov-20 11:21
mvahoney the codewitch28-Nov-20 11:21 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Amarnath S27-Nov-20 14:40
professionalAmarnath S27-Nov-20 14:40 
GeneralRe: Never Let A Opportunity Go to Waste Pin
#realJSOP27-Nov-20 23:16
mva#realJSOP27-Nov-20 23:16 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Sander Rossel28-Nov-20 1:55
professionalSander Rossel28-Nov-20 1:55 
GeneralRe: Never Let A Opportunity Go to Waste Pin
#realJSOP28-Nov-20 7:31
mva#realJSOP28-Nov-20 7:31 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Sander Rossel28-Nov-20 9:32
professionalSander Rossel28-Nov-20 9:32 
GeneralRe: Never Let A Opportunity Go to Waste Pin
Kelly Herald1-Dec-20 8:15
MemberKelly Herald1-Dec-20 8: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.