|
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.
|
|
|
|
|
Provided you can find the process (which isn't complicated even if you didn't launch it) you can use SendKeys to send the CTRL+A, CTRL+C combination to the console app.
AFAIK, there isn't a way to "just read the text" from a generic console window after it has been written there.
This may help: https://dzone.com/articles/automatically-send-keys-other[^]
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!
|
|
|
|
|
Add some smarts to redirect console output as required.
Console.SetOut(TextWriter) Method (System) | Microsoft Docs
Note that you can then read your own console output if need be (if you redirect to a file).
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
|
|
|
|
|
CTRL-A is supposed to select all text in a control or context in Windows. However, it doesn't seem to work in either the PowerShell window or Windows Terminal. I would be very curious about a solution as well.
|
|
|
|
|
CTRL-A is commonly used to select all text, but it must be implemented by the application itself. It works fine in a cmd window, but powershell ISE/console seems not to work.
|
|
|
|
|
Just did an experiment. I opened CMD.exe and CTRL-A worked. Then I typed powershell.exe and powershell opened in the CMD.exe window. CTRL-A no longer works. Exit powershell to CMD.exe and CTRL-A works again. So PowerShell is eating CTRL-A and not doing anything with it.
|
|
|
|