8

किसी को भी निम्न आदेश के उत्पादन में निर्देशिका बदलने का तरीका पता है:एएसपीनेट कोर 1.1 पर माइग्रेशन के लिए आउटपुट फ़ोल्डर को कैसे बदला जाए?

dotnet ef migrations add Initial --context EsportshubApi.Models.ApplicationDbContext 

??

मैं विकल्प जोड़ने की कोशिश की:

--content-root-path 'Migrations/Identity' 

लेकिन वह कुछ नहीं करता। एक -डेटा-डीआईआर विकल्प भी है और निर्देशिका के साथ कुछ और है, लेकिन उनमें से कोई भी माइग्रेशन के लिए आउटपुट नहीं है।

मेरे समस्या मैं 2 DbContexts है तो मैं चाहता हूँ से अपने माइग्रेशन अलग है।

उत्तर

14
dotnet ef migrations add Initial --context EsportshubApi.Models.ApplicationDbContext -o YourFolderPath 

Source

Usage: dotnet ef [options] [command] 

Options: 
    -h|--help       Show help information 
    -p|--project <PROJECT>    The project to target (defaults to the project in the current directory). Can be a path to a project.json or a project directory. 
    -s|--startup-project <PROJECT>  The path to the project containing Startup (defaults to the target project). Can be a path to a project.json or a project directory. 
    -c|--configuration <CONFIGURATION> Configuration under which to load (defaults to Debug) 
    -f|--framework <FRAMEWORK>   Target framework to load from the startup project (defaults to the framework most compatible with .NETCoreApp,Version=v1.0). 
    -b|--build-base-path <OUTPUT_DIR> Directory in which to find temporary outputs. 
    -o|--output <OUTPUT_DIR>   Directory in which to find outputs 

Commands: 
    database Commands to manage your database 
    dbcontext Commands to manage your DbContext types 
    migrations Commands to manage your migrations 
+1

क्या आप जानते सी # में फ़ोल्डर सेट करने के लिए कैसे करें? मैं हर बार एक अतिरिक्त तर्क का उपयोग नहीं करना पसंद करूंगा। –

+0

यह ** ** ** सी # चीज नहीं है। आप .NET कोर कमांड लाइन का उपयोग कर अपने .NET कोर एप्लिकेशन (और यहां तक ​​कि एंटीटी फ्रेमवर्क कोर) को एक कमांड भेज रहे हैं जो .NET कोर एसडीके के साथ आता है। कई महीनों से मैंने .NET कोर पर काम नहीं किया है, इसलिए मैं आपके प्रश्न का उत्तर नहीं दे सकता। मुझे यकीन है कि इससे पहले कि संभव हो गया था और मैं नए नेट कोर सुविधाओं का पालन नहीं किया ... –

+0

नहीं तो आप सिर्फ इतना है कि अपने आदेश में शामिल है अगर आप इसे हर बार टाइप करने के लिए आलसी हैं एक 'cmd' फ़ाइल बना सकते हैं नहीं कर रहा हूँ। –

संबंधित मुद्दे