Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
The question was about the concept of database first or code first.
When i'm using database first, how i can check if my database is already created and filled.
Thanks
Really, you are asking two different questions. Entity Framework is not a database administration tool and as such does not have any functionality for directly loading data from a spreadsheet.
If you research each part of your question separately, you might have more luck.
Seeding data with Entity Framework
Reading Excel Files with C#
Reply to comment:
if (!context.PostalCodes.Any())
{
IEnumerable<PostalCode> postalCodes = ReadPostalCodes();
foreach(var postalCode in postalCodes)
{
context.PostalCodes.Add(postalCode);
}
context.SaveChanges();
}
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I tried to update model/table in the ORM but it still shows there even after updating it.
I don't know what is the problem in this even i have changed the table name and deleted my models using select all then delete in the ORM and removed EDMX as well but still same issue persists.
Found the solution to my answer as i was creating table without primary key so it didn't add it in the ORM.
Using primary key worked with me.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
The community reviewed whether to reopen this question 7 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I want to use in-Memory entity framework , could you help me guys
I can't find a way to use In memory db # entity framework 6.2.0
Yes, there is an in-memory provider for EF6 available: https://entityframework-effort.net/
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
After adding the framework to my project I am unable to add more tables to the framework. Tried "updating model from database" in the database design in Visual Studio but it does not save the new table I want to add though it sees the new table in the database that is not in my model but does not add it
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am working in MVC. The user will enter data for about 50 fields, I will get this data in a class object from the view.
So, how can I copy this class object to an edmx table object in order save data into data base in c# ?
Try adding http://automapper.org/ in your project and in your code you would write something like.
var address = Mapper.Map<Address>(yourViewModel);
......................
.......................
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Excuse me I have a problem with Connecting Kentico Database I want to insert data to Kentico Database. What api for do it ? and how to i do it ? . Give a Doccument[link] or sample code for me please .
i will try to use api ITableManager,DatabaseHelper,ITableManager Properties. but i don't know about it
Sir, you haven't shown any effort trying to resolve your issue. Please read the documentation first.
Plus, there are API Examples directly in the Kentico UI which you can have a look at. They demonstrate the basic (CRUD) operations with objects and documents.
Basically, to work with documents use DocumentHelper / TreeProvider (DocumentHelper.InsertDocument(...)). To work with other objects use *InfoProvider (e.g. UserInfoProvider.SetUserInfo(...)).