.Net Web APi/Angular 6 - Lesson 1

slickdeath

Well-known member
  • Sep 3, 2014
    3,347
    1,623
    113
    Good work bro. Rep+

    Puluwannam mcn db first karana widihath damu. Ethkota dewidihama cover wenwane. Anith eka ara ekkenk kiwa wage video ekak karala YouTube danna. Eka oyatath lesi anikakeeyak hri hoyagannath puluwn.
     

    slickdeath

    Well-known member
  • Sep 3, 2014
    3,347
    1,623
    113
    Not a standard machan, programming standard is camel case...
    c# is Case sensitive language and no restrictions on variable or function definition

    Property names should use Pascal case. Thats the standard in c#. Variable names should use camel case. Properties and variables are two different things. C# has auto implemented properties. They look similar to variables. But they are not the same.
     

    shiwankaswe

    Well-known member
  • Apr 30, 2007
    7,557
    629
    113
    Colombo Sri Lanka
    Property names should use Pascal case. Thats the standard in c#. Variable names should use camel case. Properties and variables are two different things. C# has auto-implemented properties. They look similar to variables. But they are not the same.

    There is no Should in c#.net
    If should means you must follow otherwise not compile, you can follow your company standards when coming to development, Microsoft never define its own standards.

    you mean properties as getters setters, yes those are pascal case, but no restriction on you must use Pascal case...
     

    HAneo

    Well-known member
  • Jan 30, 2007
    12,970
    29,167
    113
    Homagama
    Property names should use Pascal case. Thats the standard in c#. Variable names should use camel case. Properties and variables are two different things. C# has auto implemented properties. They look similar to variables. But they are not the same.

    මේක ගැන පොඩි අදහසක් ගන්න පුළුවන් දැනට තියන ක්ලාස් වල ඉම්ප්ලිමන්ට් වෙලා තියන විදිහ බැලුවාම

    Code:
    public class DbContext : IDisposable, IObjectContextAdapter
     {
     public DbContext(string nameOrConnectionString);
     public DbContext(string nameOrConnectionString, DbCompiledModel model);
    
    
     public DbChangeTracker ChangeTracker { get; }
     public DbContextConfiguration Configuration { get; }
     public Database Database { get; }

    Property names should use Pascal case. - මේ කතාව වැරදි නේ
    Code:
    public DbChangeTracker ChangeTracker { get; }
     

    bitch_please

    Active member
  • Jan 28, 2016
    249
    55
    28
    Good Job Machan....And Thank you for all the hard work you are putting on to this.Could you please tell me why did you opt for code first approach rather than database first approarch ?
     

    HAneo

    Well-known member
  • Jan 30, 2007
    12,970
    29,167
    113
    Homagama
    There is no Should in c#.net
    If should means you must follow otherwise not compile, you can follow your company standards when coming to development, Microsoft never define its own standards.

    you mean properties as getters setters, yes those are pascal case, but no restriction on you must use Pascal case...

    There is no Should in c#.net:yes::yes::yes:

    but take a look at this . when you say

    Code:
    public int MyProperty { get; set; }

    slandered is to use camel case

    it's cus you can say this

    Code:
     private int myProperty;
    
            public int MyProperty
            {
                get
                {
                    return this.myProperty;
                }
                set
                {
                    this.myProperty = value;
                }
            }

    both are same in implementation. but second one the variable name
    should be pascal case
     

    HAneo

    Well-known member
  • Jan 30, 2007
    12,970
    29,167
    113
    Homagama
    Good Job Machan....And Thank you for all the hard work you are putting on to this.Could you please tell me why did you opt for code first approach rather than database first approarch ?

    it's free of coding.
    just think that you have class and it's already implemented.
    now some one asked to put 3 fields to it. so first you have to change the DB and then EDMX so onn.

    but it code first you just change class and keep working.
    when you need these 3 fields on database you just migrate

    Code:
    update-database -f

    it's simple

    also EDMX file regenerating every time it updated as i remember
    it's little hard to work some times rather than change class direly
     

    slickdeath

    Well-known member
  • Sep 3, 2014
    3,347
    1,623
    113
    Property names should use Pascal case. - මේ කතාව වැරදි නේ

    Ai mokakda mcn weredda.? Property name ekata Pascal case use karanne mn danna widihata. Private field ekak nm camal case use karanwa underscore ekakin prefix karala
     

    HAneo

    Well-known member
  • Jan 30, 2007
    12,970
    29,167
    113
    Homagama
    Thanks for sharing Bro. REP 11+
    thankx
    patta digatama kragena yanna mchan
    thankx
    Ai mokakda mcn weredda.? Property name ekata Pascal case use karanne mn danna widihata. Private field ekak nm camal case use karanwa underscore ekakin prefix karala

    :lol::lol:
    again i am sorry .. you are right. fuck me never happen again
    just mixed up those word with start capitalization
    hehehe sorry
     

    shiwankaswe

    Well-known member
  • Apr 30, 2007
    7,557
    629
    113
    Colombo Sri Lanka
    but take a look at this . when you say

    Code:
    public int MyProperty { get; set; }

    slandered is to use camel case

    it's cus you can say this

    Code:
     private int myProperty;
    
            public int MyProperty
            {
                get
                {
                    return this.myProperty;
                }
                set
                {
                    this.myProperty = value;
                }
            }

    both are same in implementation. but second one the variable name
    should be pascal case

    You're referring to 2 c# versions, thats it

    Still, I need to say no Ward Should
     

    shiwankaswe

    Well-known member
  • Apr 30, 2007
    7,557
    629
    113
    Colombo Sri Lanka
    Your really doing good job, but better you find what will happen when you use these

    AutomaticMigrationsEnabled = false;

    update-database -f -script

    if someone use this with database that having production data, some time you will fucked up
     
    Last edited: