Di seguito i passaggi per configurare correttamente il flusso di lavoro con:

  • Visual Studio 2017 – Community Edition
  • Entity Framework 6.0
  • SQL Server 2017 – Express Edition

Procedura per creare un database SQL:

  • Installare Visual Studio Community
  • Installare SQL Server 2017 – Express Edition in versione Basic
  • Configurare l’istanza di SQL Server (sarà molto simile a NOMEPC\SQLEXPRESS)
  • Installare SQL Server Management Studio (SSMS)
  • Accedere a SSMS accedendo con Windows Authentication (non è ancora presente un utente SQL)
  • Click destro sul nome dell’istanza (menu a sinistra) tipo NOMEPC\SQLEXPRESS e “Properties”
  • Impostare in “Security” la voce “SQL Server and Windows Authentication mode” (potremo accedere con un nostro utente user/psw). Salvare
  • Click destro su Databases (menu a sinistra) e “New database” assegnando un nome al db (lasciando il resto inalterato). Salvare
  • Click destro su Security > Logins e “New Login”
  • In “General” inserire un “Login name” di utente, le password e deselezionare la voce “Enforce password expiration”
  • In “Server Roles” selezionare “sysadmin” (lasciare selezionato anche “public”)
  • In “User Mapping” selezionare il nome del database (nella colonna user comparirà il nome utente corrente)
  • Nelle “roles” selezionare “db_owner” (lasciare selezionato anche “public”). Salvare l’utente.
  • Per verifica scollegare l’istanza corrente (click destro e “Disconnect”)
  • Collegare una nuova istanza, in server name inserire il nome di istanza tipo  NOMEPC\SQLEXPRESS, in Authentication selezionare “SQL Server Authentication” e inserire le credenziali dell’utente creato. Poi Connettersi.
  • Se tutto è andato a buon fine si dovrebbe poter accedere all’istanza di SQL Server sul PC con l’utente creato

Procedura per configurare un progetto Entity Framework 6.0:

  • Avviare Visual Studio 2017 – Community Edition
  • Creare un progetto Asp.NET Web Page – Vuoto
  • Avere cura di selezionare tra le proprietà del progetto la versione Framework
  • Inserire un nuovo elemento “Add New Item…” selezionando “ADO.NET Entity Data Model” dando un nome al model
  • Selezionare una modalità di lavoro (solitamente EF Designer From Database, la prima).
  • Selezionare una connessione al database (presente o in “New Connection”) scegliendo poi <other>
  • In Data Source vedrete “.NET Framework Data Provider for SQL Server”, in server name inserire l’istanza tipo NOMEPC\SQLEXPRESS (solitamente non la trova in automatico)
  • In Authentication selezionare “SQL Server Authentication” e inserire username e password creati precedentemente
  • A questo punto la stringa di connessione verrà creata (specificando Yes o No nella sicurezza)
  • Verrà creato il designer del database dinamico

Esempio di codice di accesso agli oggetti EF:

using (AppEntities db = new AppEntities())
tblUsers utente = db.tblUsers.Where(x => x.email == “email@dominio.com”).FirstOrDefault();
label.Text = utente.firstname;

Procedura per esportare un database SQL (file .bak):

  • Click destro sul nome del database, poi “Task” e “Back up…”
  • Sarà già tutto configurato con la generazione del file .bak in una directory specifica (solitamente “C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\Backup\”)

Procedura per esportare un database SQL (file .sql):

  • Click destro sul nome del database, poi “Task” e “Generate Script…”
  • Selezionare le specifiche tabelle di cui fare il backup dalla lista (o intero db)
  • Proseguendo selezionare “Save script to a specific location” e accedere al menu “Advanced”
  • Selezionare tra le numerose opzione la voce “Types of data to script” e poi “Schema and Data” (verrà generato lo script di creazione della tabella ma anche quello di inserimento di tutti i dati già presenti nel database), non solo lo schema.
  • Procedere con la generazione dello script (in formato .sql oppure nella “New query window”)


  1. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why waste your intelligence on just posting videos to your site when you could be giving us something informative to read?|

  2. It’s the best time to make a few plans for the longer term and it is time to be happy. I have read this publish and if I may I want to suggest you few attention-grabbing issues or suggestions. Perhaps you can write subsequent articles regarding this article. I wish to learn even more issues about it!|

  3. Hey would you mind stating which blog platform you’re working with? I’m looking to start my own blog soon but I’m having a tough time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something unique. P.S Apologies for being off-topic but I had to ask!|

  4. My partner and I stumbled over here by a different page and thought I might check things out. I like what I see so now i am following you. Look forward to exploring your web page again.|

  5. Excellent blog you have here but I was wondering if you knew of any discussion boards that cover the same topics discussed in this article? I’d really love to be a part of group where I can get feed-back from other experienced people that share the same interest. If you have any recommendations, please let me know. Kudos!|

  6. Howdy would you mind letting me know which web host you’re utilizing? I’ve loaded your blog in 3 different browsers and I must say this blog loads a lot faster then most. Can you suggest a good hosting provider at a reasonable price? Many thanks, I appreciate it!|

  7. Howdy I am so thrilled I found your site, I really found you by mistake, while I was searching on Askjeeve for something else, Nonetheless I am here now and would just like to say cheers for a marvelous post and a all round entertaining blog (I also love the theme/design), I don’t have time to read through it all at the minute but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read much more, Please do keep up the great work.|

  8. After I originally commented I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on whenever a comment is added I get 4 emails with the exact same comment. There has to be an easy method you are able to remove me from that service? Cheers!|

  9. With havin so much content do you ever run into any problems of plagorism or copyright violation? My blog has a lot of unique content I’ve either authored myself or outsourced but it looks like a lot of it is popping it up all over the internet without my authorization. Do you know any ways to help prevent content from being ripped off? I’d truly appreciate it.|

  10. I was suggested this blog by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my difficulty. You are wonderful! Thanks!|

  11. I know this if off topic but I’m looking into starting my own blog and was wondering what all is needed to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very web savvy so I’m not 100 sure. Any tips or advice would be greatly appreciated. Kudos|

  12. I have been exploring for a bit for any high-quality articles or blog posts in this sort of space . Exploring in Yahoo I at last stumbled upon this website. Reading this info So i’m happy to show that I’ve an incredibly excellent uncanny feeling I discovered exactly what I needed. I most no doubt will make certain to don?t omit this site and give it a look on a constant basis.|

  13. I got this site from my buddy who informed me about this web site and at the moment this time I am visiting this website and reading very informative articles here.|

  14. Hey there, I think your website might be having browser compatibility issues. When I look at your website in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, wonderful blog!|

  15. An impressive share! I’ve just forwarded this onto a friend who has been doing a little homework on this. And he in fact bought me lunch due to the fact that I found it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanx for spending time to discuss this subject here on your blog.|

  16. I think what you composed was actually very reasonable. But, what about this? suppose you were to create a killer title? I ain’t suggesting your information isn’t solid, but suppose you added something to possibly grab a person’s attention? I mean BLOG_TITLE is a little boring. You ought to look at Yahoo’s home page and watch how they create post titles to get people to click. You might add a video or a related pic or two to grab people excited about what you’ve got to say. Just my opinion, it could bring your posts a little bit more interesting.|

  17. Hi! I know this is kinda off topic but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having trouble finding one? Thanks a lot!|


Please enter your comment!
Please enter your name here