In previous versions of EF one was able to store images as a byte array and retrieve them using the System.Drawing namespace. Is there a equivalent to the System.Drawing namespace in EF Core or is this a feature that has not been implemented yet?
There is a prototype of System.Drawing for .NET Core in github.com/akoeplinger/mono-winforms-netcore.
System.Drawing will also be part of .NET Standard 2.0
We ended up using Azure Blob Storage for our application and using the Azure Storage Emulator for local use. We saved and retrieved them from those locations instead of byte arrays.
Related
I am working with sql server and entity framework in a web ASP.Net C# Project. I am working with "Database first" concept. This mean i draw my database structure from sql server management studio on my local development computer. I add fields, rename fields, add table, change type, etc in the life of my project.
What i want to do is to see what to do when i want to apply database structure changes on my production(s) server(s). Is there a way for entity framework to "detect" changes with a concept of migration versioning like in symphony doctrine ? I actually patch by hand by applying sql scripts on my production server.
Thanks
In all cases you need to do some development tasks
Depends on the entity framework model you are using,
Code first approach : then you can use the reverse engineering, you can find this extension online, you can use the Tools > Extensions and Updates to find it , or you can update your classes manually.
Model first approach: then right click inside the edmx and Update Model from database
I have a number of tables inside a database that I use for 4-5 different websites. These tables already exist and have plenty of data and views/stored procedures/functions etc. already completed.
I would like to provide an api to give access to each of these tables to whichever website I happen to be using so they're accessing the data in a consistent manner. I have Visual Studio 2015 and have been trying to create a Web Api using EntityFramework.
However, every tutorial I find for accessing databases insists on creating the database and tables within the code for the api, and utilizes just the tables with the various CRUD actions handled within.
As I have the tables built, I don't want to recreate them, and as I have some programming already in place using functions/stored procs, I don't really want to reinvent the wheel and recreate it all.
I did find this: http://www.c-sharpcorner.com/UploadFile/4b0136/working-with-stored-procedures-using-entity-framework-part/ for EF6 (though I believe I'm using EF7, but that seems to be importing each function in turn, which seems.. kludgy)
So my question is two-fold:
Is ASP.NET 5 web api the right tool for the job?
Can the ASP.NET 5 web api handle stored procedures easily?
At time of writing it's currently easier to build an API over an existing database using ASP.NET 4.6 and EF 6. This tutorial describes how you can go about building a model from an existing database:
http://www.asp.net/mvc/overview/getting-started/database-first-development/creating-the-web-application
Once you have a model and your classes in place, you can then follow any article on scaffolding Web API.
I am currently working on a project which may require the ability to generate a Core Data model and classes automatically from a JSON feed which describes each object, it's properties and relationships. This would enable our company to quickly generate a working core data database from our CRM at the start of each project.
Is this possible/easy to achieve? If so, does anyone have any tips on where I can get started?
I have already created various iOS apps which use Core Data but I have never made one which needs to automatically create a Core Data model.
Yes, you can create a Core Data model dynamically. An NSManagedObjectModel can be created without a stored model, and NSEntityDescription/NSAttributeDescription instances can be defined and added to it before being passed to an NSPersistentStoreCoordinator. Apple has an example of doing this in their Core Data Utility Tutorial.
Using Model First, what is the best way to approach preservation of existing database data when the model changes and the database has to be regenerated?
The Database Power Pack extension no longer works (I've been trying to contact the author). I can't find anything that provides similar functionality.
R.
If database power pack doesn't work there is no other automatic way. Manual way requires running created SQL script on another database and using Visual Studio Database tools to create difference script between the current and the newly created database.
I'm working on an iPhone app that uses NSURLConnection to down load files and then convert those files into sqlite3 tables. I would like to use core data to store these tables and to create all the applicable objects. So, do I have to build the models of the data in XCode with the graphical tool representing all the table names and columns? I've been searching and found examples of apps that use core data and copy in a pre populated sqlite file for the default data. The data that I'm working with will have some variations in the table names and column name and types. Any direction would be appreciated.
You need to load the database via a Core Data model within a Core Data application. You can't use a sqlite database that was not created with Core Data (without a huge amount of unsupported pain).
Core Data databases created with applications on Mac OS X are compatible with Core Data applications on iOS. I know of a number of developers that have written little command line tools that run as a part of building their iOS application that effectively "compile" a database that is then copied into the application's app wrapper.