|
I'll throw my opinion into this … but bear in mind that this is only an opinion, I'm sure others will shout me down and that's ok too.
- I cannot think of a single advantage of Code First.
- I personally only ever use SSMS to create my tables, relationships etc.
There are arguments to both sides e.g. entity framework - Code-first vs Model/Database-first[^]
|
|
|
|
|
I agree you . i don't like to use EF for many reasons and yes you have right
EF wrote for you everything and that is the part which is almost don't like it
When things go wrong, you are going to need to look deep into the code from EF wrote for you. So how fast can you read and undersatand the generated code so that you can identify what the issue is and how to fix it? and etc etc .. but sometimes it's interesting to create tabels or use Code first using C# Dapper Plus for instance doing great job about it .
|
|
|
|
|
|
I agree with CHill60 - I always use SSMS.
Data design is too important, it needs careful thinking about if it's going to be both performant and flexible. Far, far too easy to "let the machine do it" and it makes unwanted assumptions about your data that lead to problems later.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: I agree with CHill60 - I always use SSMS.
nice to hear your opinion
|
|
|
|
|
Abdalla Ben Omran wrote: Dapper
As far as I can see, Dapper[^] simply maps the query results to objects. It doesn't provide any utilities for creating or maintaining database structure, other than raw ADO.NET commands.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
yes you are right . i thought its doing Code First as well.
|
|
|
|
|
Richard Deeming wrote: As far as I can see, Dapper[^] simply maps the query results to objects. It doesn't provide any utilities for creating or maintaining database structure, other than raw ADO.NET commands.
look here please. that what i have meant
Online Example | Dapper Plus[^]
|
|
|
|
|
Depends on whether it is new development or "maintenance".
With new development, the requirements and feasibility (e.g. skills; interfacing) dictate the technology.
With maintenance, you stick with what's there.
(it's never as simple as picking items from a menu).
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
I generally parallel the tables and classes; generally I will write out the class properties and copy/paste via Excel into a new SSMS query window.
If it is an existing table, I will open in design view; then copy/paste into as the properties of a new class object (again via Excel).
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
It's interesting.
Are you using VBA code?
|
|
|
|
|
Maciej Los wrote: It's interesting.
Are you using VBA code?
No. i am using C#
Sqlcommand to create tables and using Dapper to read,insert ...etc
what do you use or what do you prefer to use ?
|
|
|
|
|
Well...
I know that you're using C#. I was asking @MadMyche about using Excel in a process of creating/updating database tables.
|
|
|
|
|
oh ja .. sorry i thought you have asked me .
by the way .. do you use IQueryable with Linq ?
|
|
|
|
|
No to the VBA, no Entity Framework, no LINQtoSQL; I am an ADO purist.
But I'll try to explain the process if it helps. After typing this it does seems really wordy and long but after many years of doing it this way it is only a matter of minutes.
- Create class properties in C#
- Copy the properties and paste in Notepad
- Use find/replace to replace spaces with tabs
- Copy the contents and paste into Excel
- Add column for natural index (1,2,3)
- Sort by Net Data Type
- Add column for SQL Data Type alongside NET data type, and populate
- Rerrange columns around to match format of CREATE TABLE syntax
- Copy and paste the desired columns into SSMS new query window
The process for SQL design to a class is similar.
I also reuse/tweak the Excel content to create instances (overloaded constructs) from IDataReaders or DataRows.
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
Nice!
Well... I'm lazy, so - probably - i'd prefer to automate it via c# code. I'd create a programme wich will acts as you described in 2-3 and 5-8. I'd save final result in a text file (with .sql extension) and use it in SSMS window.
I like your idea and i really appreciate it.
|
|
|
|
|
Glad it can be used, even if it is only inspirational... I guess I'm too lazy to write the program to do it
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
|
I'll put it onto my ToDo list
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
MadMyche wrote: I guess I'm too lazy to write the program to do it Having written such a program in the 90's for VB6, reworked for VB.net then for c# and now producing such things as WPF razor page templates and the CRUD stored procs I can relate to that. Except I start from the other end, create the tables in SSMS and then use ClassBuilder to do the bulk of the CRUD code.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Having been a developer for over 20 years, and a SQL DBA and Administrator since 6.5. My Preference is to design the database using Management Studio. I do it this way
#1. Design the raw tables include the fields for the Foreign keys BUT do not link them yet
#2. Design your Clustered indexes I will name them IDX_tablename
#3. Be lazy and use the Database Diagrams tool to define your Foreign Keys
My reason for doing this if the DB is designed correctly your app will be far more stable. If you design your foreign keys first it becomes your clustered indexes and normally you will cluster on a name or account number and not the ID.
|
|
|
|
|
Thanks for shared your experience David Johnson. its nice to know that
|
|
|
|
|
Code first is just for people that don't understand databases.
|
|
|
|
|
Hi
Is there a command to select all text on console window screen?
I would like to copy the last screen of text on the console window and save in a text (.scr)file
Manually I use Alt + spacebar, E, S to select all and right click the mouse to copy.
I run a program in Visual Studio which displays in a console window.
Numerous times text is printed to the screen, used and cleared.
The last screen of text contains useful information, saved as a script file, and run in a CAD program to draw cabinets and parts.
Manual keyboard shortcuts work. A "command" to do the same function would be nice.
|
|
|
|
|
If this is your own program then write everything to a file as you read it or display on the screen. If it is an app that you do not have the source for then you can redirect all output to a file quite simply with the > operator.
|
|
|
|