I have simply no words to praise you! You are a lifesaver and a GEM ! Few hours ago was panicking about a task using API. Now seeing the hope that I'll be able to complete it all by myself.
-If you are having problem Adding the Controller, for some reason, you have to Build Solution before you add the EmployeesController (5:52 into the video) (Comments below). Also by Updating Entity Framework from Tools > NuGet Package Manager > Manage NuGet Packages for Solution. -Si tienes problema para añadir el controlador Compila el proyecto "Solucion"EmployeService" dando click derecho sobre el . Tambien hay que actualizar el Entitiy Framework
if someone gets ERROR by adding a Controller: Many Thanks Mr. Kudvenkat for your effort. If someone gets an error by trying to create 'EmployeesController', please create another project and by selecting the 'Web API' before clicking on next, click the button 'Change authentication' and change it to individual user accounts. This solution worked for me.'
For those having trouble adding the controller First: Update Entity Framework from Tools > NuGet Package Manager > Manage NuGet Packages for Solution. (I simply updated all packages that required an update) Second: Restart Visual Studio. Third: Right click Solution '*Your Solution Here*' & click REBUILD SOLUTION. Last: Attempt to add controller. This method worked for me. Good luck
Thank you very much for taking time to give feedback. This means a lot. I am very glad you found the videos useful. I have organised all the Dot Net & SQL Server videos in to playlists, which could be useful to you ruclips.net/user/kudvenkatplaylists?view=1&sort=dd If you need DVDs or to download all the videos for offline viewing please visit www.pragimtech.com/kudvenkat_dvd.aspx Slides and Text Version of the videos can be found on my blog csharp-video-tutorials.blogspot.com Tips to effectively use my youtube channel. ruclips.net/video/y780MwhY70s/видео.html If you want to receive email alerts, when new videos are uploaded, please subscribe to my youtube channel. ruclips.net/user/kudvenkat If you like these videos, please click on the THUMBS UP button below the video. May I ask you for a favor. I want these tutorials to be helpful for as many people as possible. Please share the link with your friends and family who you think would also benefit from them. Good Luck Venkat
Hi Venkat, your tutorials are simply awesome. Please share one video for Authentication and Authorization in WebApi. One Web client example using Json to consume the WebApi example would be very helpful as well. Thanks in advance.
When adding the connection to the DB on VS 2017. I had to include the full server name to my local system to get it to work. (server) or "." would not work and test connection would fail. Example: User/SQLExpress Hope this helps.
I am eagerly waiting for upcoming videos. I have almost watched every series of you. You are wonderful. Venkat Garu, Please post next videos as soon as possible.
In addition to your awsome and incredible tutorials(espacially using vs 2015) I would like to add a comment that I had a problem adding the database so I just wanted to add my insight that I needed to write in the server name input .\(servername) notice the "\" sign it's a backslash (\). and then it worked!!! Thanks Venkat you are great!!!! Love your movies.
I like your videos man. I am trying hands on as well. I know its require lot of effort to build a tutorial of such a quality. I contribute by watching all the advertisements :). Keep it up
For everyone struggling with displaying the list or single item because of: "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'." just add Configuration.ProxyCreationEnabled = false; in constructor of the context class
in case u got the error (A network-related or instance-specific error occurred while establishing a connection to SQL Server.) Do the below steps:- Open "SQL Server Configuration Manager" Now Click on "SQL Server Network Configuration" and Click on "Protocols for Name" Right Click on "TCP/IP" (make sure it is Enabled) Click on Properties Now Select "IP Addresses" Tab -and- Go to the last entry "IP All" Enter "TCP Port" 1433. Now Restart "SQL Server .Name." using "services.msc" (winKey + r)
Great tutorial. Got it working with ease. However, one thing I couldn't get working was to enable SQL that is generated by the Enity Framework to be displayed in the Debug Output window. How do you set it up so that SQL is generated to the debug output window?
Hi man, I have a problem adding the ADO.NET to my project. I changed versions it still did not help, I even went to the newest one which is 5.0 I get this error("The project's target framework does not contain Entity Framework runtime assemblies. Please review the target framework information in the project property page."). Any ideas on how I fix this?
Hello and thank you for this wonderful tutorial! I have a question about web API. I understood the main idea of the web api but I did not understand how an end-user can use it. In 11.00 minute you entered an id number to the URL but for an end-user it is not practical to use it. How can we convert it to a graphical user interface? Or how can we use web api in a real application? Thanks in advance!
@@ishfaqbabar1192 Thank you so much for your response! But I wanted it for the end-user. An end user would prefer using the Website UI instead of using a framework like Swagger.
hi venkat, when i am adding entity data model to EmployeeDataAccess project it is giving me this error: project target framework does not contain entity framework runtime assemblies. Please give solution for this
Hi Venkat, one question here if suppose we want to change the Salary column data type to float but it should not change it in the database itself, is this possible to do
"Employee Service" project under the solution will require entity framework installed... Otherwise data will not be available and an error will raise!!!
i have followed all the steps properly yet i am not able to add the "using EmployeeDataAccess" project to the controller. Any idea how to resolve the problem?
Hi venkat! I am getting this error, can you help? Cannot implicitly convert type 'UserInfoDataAccess.SM_UserInfo_ST' to 'System.Collections.Generic.IEnumerable'. An explicit conversion exists (are you missing a cast?) Regards, Kamran
Can I use Dependency Injection to inject the DbContext inside the controller constructor? Nowadays this is the moden way to get access to the DbContext instead explicitly call the using inside the controller.
Hello Sir. Thanks for the amazing videos. I have a question:- I have used this example to the dot but even after hitting the url with a parameter (Ex:- api/employees/4), i get all the employees instead of just the one I want. Please help!!
go to your solution project and right click on it and find "Rebuild solution" and w8 for a moment till it finished rebuild, then u can add controller after that . Hope it works!
Dont know if you are still around...I am using EF 6 and i have foriegn keys. When i run the simple get method "'ObjectContent`1' type failed to serialize the response body" error. If i cut the FK connection it works fine. Can you explain how to fix
It was a mess trying to add a class library and then reference it's ADO.NET Entity Framework model. I just added Entity Framework reference directly into the main project and was just fine in VS 2017.
Hm... I know this video was made a while ago but in VS 2019 I could not get the Employees controller to work without first creating an entity model in the Server project (the same way we did in the class library project). I think Entity Framework has fallen out of favor a bit and the references which once used to be installed by default no longer are. I can kind of see why EF would not be popular; I got many security warnings about a script possibly corrupting my PC and then the IDE crashed. I got it running after reopening the solution. This seems a very convoluted way of connecting to a database.
Severity Code Description Project File Line Suppression State Error CS1674 'EmployeeDBEntities': type used in a using statement must be implicitly convertible to 'System.IDisposable' WebApplicationdatabase C:\Users\DELL\source epos\WebApplicationdatabase\WebApplicationdatabase\Controllers\EmployeeController.cs 15 Active i am getting that
I get the error "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'" . Any help appreciated
Hi guys, Im getting the below error: Could not load file or assembly 'EmployeeDataModel.cs' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Could you please help me with any solution, please.
Hi! Thank you for the helpful video. There is a question. How do I publish this project? The fact is that after publishing the service, an error occurs with connecting to the database.
It is possible, if I'm using entity framework and my data is coming to stored procedures on my crystal reports? btw I'm using desktop application this application is connected already to the cloud sql server. any inputs @kudvenkat thank you !
Dear Venkat, EmployeeEntities create by EF is not inherit from IDisposable where as Using block uses IDisposable interface. Hence if i am adding using block it is giving me an error "type used in using statement must be implicitly convertible to system.idisposable"
Install EF from nuget in your service project. For reference follow this link forums.asp.net/t/1856121.aspx?%20System%20Data%20Entity%20DbContext%20is%20defined%20in%20an%20assembly%20that%20is%20not%20referenced
Dear Mr, In case I need to use a stored procedure from DB in sql server and this stored procedure has many parameters and many join to many tables and return many fields from many table how to call and use it with WEB API Controller? Many thanks and best regards,
I didnt get it why did you build an MVC project instead of a Web API project? You dont need that extra stuff which ships with MVC. Can you please explain that part?
Error: Cannot implicitly convert type 'EmployeeDataAccess.employee' to 'System.Collections.Generic.IEnumerable'. An explicit conversion exists (are you missing a cast?) What should i do for this ?
Hi Venkat Garu, I am getting below issue .Even I add the Entity Framework from NuGet Package and Connection string also added to webconfig file also. Even i add the Newtonsoft.Json Code to WebApiConfig .cs also. Please give the solution for the below issue. {"$id":"1","Message":"An error has occurred.","ExceptionMessage":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.","ExceptionType":"System.InvalidOperationException","StackTrace":null,"InnerException":{"$id":"2","Message":"An error has occurred.","ExceptionMessage":"Error getting value from 'Contacts' on
When it displays Login failed for user sa when you access the api/employees in your browser, do the following: 1.Go to the web.config file in the solution 2. In the connection strings, make sure EmployeeDBEntities connection string is present 3. Locate the 'user id=sa' text on that line 4. If all above is done well, add a password field such as - password=(yourpassword) 5. It should look like "...;user id=sa;password=orangebananas;..." 6. Rebuild the solution and test if it works
Hello, I followed all the steps mentioned in the video but I get below error" The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'. System.InvalidOperationException I tried with solution in WebApiConfig file in Register method config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html")) OR var json = config.Formatters.JsonFormatter; json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects; config.Formatters.Remove(config.Formatters.XmlFormatter); Also in Global.asax file in App_start event GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter); but even after all these solution I am still getting the same error. Can u help me to resolve this issue.
When adding the WebApi 2 Controller i keep getting an error that says "There was an error running the selected code generator: 'Could not load file or assembly 'EmployeeDataAccess.dll' or one of it's dependencies. The system cannot find the file specified.'
Hi, thank you for this tutorial. After rebuilding my solution I keep receiving 2 errors that I can't figure out how to solve. I already looked at the comments and try them out, but it seem not to work for me. Here's the error output: 1>------ Rebuild All started: Project: EmployeeDataAccess, Configuration: Debug Any CPU ------ 1>C:\Users\MyName\source epos\EmployeeService\EmployeeDataAccess\EmployeeDataModel.Context.cs(28,30,28,38): error CS0246: The type or namespace name 'Employee' could not be found (are you missing a using directive or an assembly reference?) 2>------ Rebuild All started: Project: EmployeeService, Configuration: Debug Any CPU ------ 2>CSC : error CS0006: Metadata file 'C:\Users\MyName\source epos\EmployeeService\EmployeeDataAccess\bin\Debug\EmployeeDataAccess.dll' could not be found ========== Rebuild All: 0 succeeded, 2 failed, 0 skipped ========== I would really appreaciate your help!
Severity Code Description Project File Line Suppression State Error CS1674 'EmployeeDBEntities': type used in a using statement must be implicitly convertible to 'System.IDisposable' WebApplicationdatabase C:\Users\DELL\source epos\WebApplicationdatabase\WebApplicationdatabase\Controllers\EmployeeController.cs 15 Active please sugget
I have a question without get method mentioned in the uri how it goes to get method in the employee controller " "api/employees/1" - only controller method but no method mentioned please tell me. thanks in advance.
I have simply no words to praise you! You are a lifesaver and a GEM ! Few hours ago was panicking about a task using API. Now seeing the hope that I'll be able to complete it all by myself.
-If you are having problem Adding the Controller, for some reason, you have to Build Solution before you add the EmployeesController (5:52 into the video) (Comments below). Also by Updating Entity Framework from Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
-Si tienes problema para añadir el controlador Compila el proyecto "Solucion"EmployeService" dando click derecho sobre el . Tambien hay que actualizar el Entitiy Framework
Error resolved..thank you...
thank you
if someone gets ERROR by adding a Controller:
Many Thanks Mr. Kudvenkat for your effort. If someone gets an error by trying to create 'EmployeesController', please create another project and by selecting the 'Web API' before clicking on next, click the button 'Change authentication' and change it to individual user accounts. This solution worked for me.'
For those having trouble adding the controller
First: Update Entity Framework from Tools > NuGet Package Manager > Manage NuGet Packages for Solution. (I simply updated all packages that required an update)
Second: Restart Visual Studio.
Third: Right click Solution '*Your Solution Here*' & click REBUILD SOLUTION.
Last: Attempt to add controller.
This method worked for me. Good luck
Thank You!
Thanks a lot! Saved my Day
@@vikrampd4808 no problem my friend!
@@pranavdhomne1703 Absolutely :)
Thanks man
You are one of the best instructors I have come across in my life. Thank you Sir.
I think this is one of the best tutorial about the subject.. thanks!!
Your videos are the best tutorials i've watched. I managed to complete my work task with the help with your tutorials. Thank you. Keep it up!!
Thank you very much for taking time to give feedback. This means a lot. I am very glad you found the videos useful.
I have organised all the Dot Net & SQL Server videos in to playlists, which could be useful to you
ruclips.net/user/kudvenkatplaylists?view=1&sort=dd
If you need DVDs or to download all the videos for offline viewing please visit
www.pragimtech.com/kudvenkat_dvd.aspx
Slides and Text Version of the videos can be found on my blog
csharp-video-tutorials.blogspot.com
Tips to effectively use my youtube channel.
ruclips.net/video/y780MwhY70s/видео.html
If you want to receive email alerts, when new videos are uploaded, please subscribe to my youtube channel.
ruclips.net/user/kudvenkat
If you like these videos, please click on the THUMBS UP button below the video.
May I ask you for a favor. I want these tutorials to be helpful for as many people as possible. Please share the link with your friends and family who you think would also benefit from them.
Good Luck
Venkat
Hi Venkat, your tutorials are simply awesome. Please share one video for Authentication and Authorization in WebApi. One Web client example using Json to consume the WebApi example would be very helpful as well. Thanks in advance.
I was losing my mind until I found your video, THANK YOU SO MUCH
Great work. Many thanks from South Africa!
One of the best videos i have seen. Got to learn for first time in my life about how API 's are developed. I could develop API watching the videos
When adding the connection to the DB on VS 2017. I had to include the full server name to my local system to get it to work. (server) or "." would not work and test connection would fail.
Example: User/SQLExpress
Hope this helps.
All of your tutorials are exceptionally well done. Thank you!
Thank you for the video. I had some minor issues, but the solution whas in the comments below the video. In general this is a good quality tutorial!
I am eagerly waiting for upcoming videos. I have almost watched every series of you. You are wonderful. Venkat Garu, Please post next videos as soon as possible.
Well done on a very balanced set of tutorials. I learned a lot. Thank you so much
Don't have words to thank you!!
Really appreciated :-)
Subscribed!
Thanks for all the videos Venkat. Looking forward to your next video!
In addition to your awsome and incredible tutorials(espacially using vs 2015)
I would like to add a comment that I had a problem adding the database
so I just wanted to add my insight that I needed to write in the server name input
.\(servername)
notice the "\" sign it's a backslash (\).
and then it worked!!!
Thanks Venkat you are great!!!!
Love your movies.
You just saved my grades, man. Thanks alot!
jamesinbou who do you mean?
I like your videos man. I am trying hands on as well. I know its require lot of effort to build a tutorial of such a quality. I contribute by watching all the advertisements :). Keep it up
Your tutorials are really good, very well explained. hats off to you Venkat...
Teaching is Top class😇👌
give video on below topic please
1.dependency injection and IOC
2.N+1 problem in enitity framework
3.Solid principle
4.design pattern
Gret Video!!! Is the first time i understand everything, thank you very much.
Super simple, great video nice brother.
Amazing video, you really made this process very simple! thanks a lot :)
Thank you so much for all your awesome videos, I'm trying to learn them all. :-)
--- IF stuck at 5:52 . Right click on Solution and choose Build Solution --- Before add Controller
Hello Doob - Thank you for sharing and helping others.
Thank you so much bro
Thank you very much, this made things really easy.
please use code first from database. it's just better for a C# and asp.net developer
Did you find any tutorial for this?
There are tutorials about code first on udemy, I can suggest some if you are interested in hearing
Please do
Thank you so much!
Try not choose Class Library NET Standar, it does not contain ADO.NET.
Thanks from Bangladesh.
VS2017 - Install-Package EntityFramework must be run in Packet Manager in order to work
Thanks a lottttttttttt couldn't have done it without your help
Thank you so much, You are a hero!!
You are awesome! Thank you
Very accurate tutorial! Thanks..
For everyone struggling with displaying the list or single item because of: "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'." just add Configuration.ProxyCreationEnabled = false; in constructor of the context class
Thanks this worked
Thanks!
Thank you Venkat Garu...Please upload video for webApi with store procedure using entity framework
@kudvenkat which screen recorder do you use to record your video?
Thank you very much, that 's great explaining
Great videos. Excellent delivery.
in case u got the error (A network-related or instance-specific error occurred while establishing a connection to SQL Server.)
Do the below steps:-
Open "SQL Server Configuration Manager"
Now Click on "SQL Server Network Configuration" and Click on "Protocols for Name"
Right Click on "TCP/IP" (make sure it is Enabled) Click on Properties
Now Select "IP Addresses" Tab -and- Go to the last entry "IP All"
Enter "TCP Port" 1433.
Now Restart "SQL Server .Name." using "services.msc" (winKey + r)
holy crap thank you!! I have no idea how long that would have taken to figure out.
Great tutorial. Got it working with ease. However, one thing I couldn't get working was to enable SQL that is generated by the Enity Framework to be displayed in the Debug Output window. How do you set it up so that SQL is generated to the debug output window?
Hi man, I have a problem adding the ADO.NET to my project. I changed versions it still did not help, I even went to the newest one which is 5.0 I get this error("The project's target framework does not contain Entity Framework runtime assemblies. Please review the target framework information in the project property page."). Any ideas on how I fix this?
Awesome lesson ! Thanks.
Hello and thank you for this wonderful tutorial! I have a question about web API. I understood the main idea of the web api but I did not understand how an end-user can use it. In 11.00 minute you entered an id number to the URL but for an end-user it is not practical to use it. How can we convert it to a graphical user interface? Or how can we use web api in a real application? Thanks in advance!
Use/Integrate SwaggerUI with webAPI
@@ishfaqbabar1192 Thank you so much for your response! But I wanted it for the end-user. An end user would prefer using the Website UI instead of using a framework like Swagger.
Congrats Great documentation
Learning a lot, thanks bro!
hi venkat, when i am adding entity data model to EmployeeDataAccess project it is giving me this error: project target framework does not contain entity framework runtime assemblies. Please give solution for this
Great tutorial! How to connect to Azure SQL database from here?
Thanks a lot it really helped me.
Hi Venkat, one question here if suppose we want to change the Salary column data type to float but it should not change it in the database itself, is this possible to do
"Employee Service" project under the solution will require entity framework installed... Otherwise data will not be available and an error will raise!!!
i have followed all the steps properly yet i am not able to add the "using EmployeeDataAccess" project to the controller. Any idea how to resolve the problem?
i have been facing issue while adding ado,net data model of target framework issue
Best Thank you so much sir
Please venkat, can you explain the prerequisites for this video series ??
Hi venkat!
I am getting this error, can you help?
Cannot implicitly convert type 'UserInfoDataAccess.SM_UserInfo_ST' to 'System.Collections.Generic.IEnumerable'. An explicit conversion exists (are you missing a cast?)
Regards,
Kamran
Awesome video , Great explanation !!!! it is good if you upload video related to Entity framework and MVC .
Can you please update this with Visual Studio 2017?
Great Tutorial, Can you give more example to get data from stored procedure sql, not only get by table, thanks.
For error 0152 do this:
Go to Tools->Options->Nuget Package Manager and disable your custom NuGet servers.
Keet Nuget.org only checked.
thanks for the Idea , its the best :)
Thanks Venkat.
Can I use Dependency Injection to inject the DbContext inside the controller constructor? Nowadays this is the moden way to get access to the DbContext instead explicitly call the using inside the controller.
Hello Sir. Thanks for the amazing videos. I have a question:- I have used this example to the dot but even after hitting the url with a parameter (Ex:- api/employees/4), i get all the employees instead of just the one I want. Please help!!
ERROR
could not load file or assembly 'EmployeeDataAccess.dll ?
Did you solve that problem? I'm having the same one with my project as well :(
go to your solution project and right click on it and find "Rebuild solution" and w8 for a moment till it finished rebuild, then u can add controller after that .
Hope it works!
after rebuild also I am not able to load the file. its a same prob. I badly need help
Check under "EmployeeService" then add in Reference
I'm having the same problem. Does anyone know how to solve it?I'm using Visual Studio 2017
Dont know if you are still around...I am using EF 6 and i have foriegn keys. When i run the simple get method "'ObjectContent`1' type failed to serialize the response body" error. If i cut the FK connection it works fine. Can you explain how to fix
It was a mess trying to add a class library and then reference it's ADO.NET Entity Framework model. I just added Entity Framework reference directly into the main project and was just fine in VS 2017.
Hm... I know this video was made a while ago but in VS 2019 I could not get the Employees controller to work without first creating an entity model in the Server project (the same way we did in the class library project). I think Entity Framework has fallen out of favor a bit and the references which once used to be installed by default no longer are. I can kind of see why EF would not be popular; I got many security warnings about a script possibly corrupting my PC and then the IDE crashed. I got it running after reopening the solution. This seems a very convoluted way of connecting to a database.
Problem solved!!
:D:D:D
ps: great videos so far!!
Great tutorial! But where is your Employee class located at?
Severity Code Description Project File Line Suppression State
Error CS1674 'EmployeeDBEntities': type used in a using statement must be implicitly convertible to 'System.IDisposable' WebApplicationdatabase C:\Users\DELL\source
epos\WebApplicationdatabase\WebApplicationdatabase\Controllers\EmployeeController.cs 15 Active
i am getting that
Thanks very much!
Thanks Please share angularjs using webapi
Hi. Thanks for the video. How do I 'publish'/transfer this from my computer to an existing web server ?
I get the error "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'" . Any help appreciated
I found answer here: stackoverflow.com/a/20252040/7169820
Hi guys, Im getting the below error:
Could not load file or assembly 'EmployeeDataModel.cs' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Could you please help me with any solution, please.
Yess Even I am getting this error,It would be great if somebody can help.
Hi! Thank you for the helpful video. There is a question. How do I publish this project? The fact is that after publishing the service, an error occurs with connecting to the database.
Hey, can i build web api between an android app and mysql server(running in a server) using .net core?
It is possible, if I'm using entity framework and my data is coming to stored procedures on my crystal reports? btw I'm using desktop application this application is connected already to the cloud sql server. any inputs @kudvenkat thank you !
Why do we need to specify connection string at two places
I mean in api as well as data access project ?
Dear Venkat, EmployeeEntities create by EF is not inherit from IDisposable where as Using block uses IDisposable interface. Hence if i am adding using block it is giving me an error "type used in using statement must be implicitly convertible to system.idisposable"
Install EF from nuget in your service project. For reference follow this link
forums.asp.net/t/1856121.aspx?%20System%20Data%20Entity%20DbContext%20is%20defined%20in%20an%20assembly%20that%20is%20not%20referenced
Dear Mr,
In case I need to use a stored procedure from DB in sql server and this stored procedure has many parameters and many join to many tables and return many fields from many table how to call and use it with WEB API Controller?
Many thanks and best regards,
wow its working thank you..
I didnt get it why did you build an MVC project instead of a Web API project? You dont need that extra stuff which ships with MVC. Can you please explain that part?
I Can't Find class library In VS2017
Error:
Cannot implicitly convert type 'EmployeeDataAccess.employee' to 'System.Collections.Generic.IEnumerable'. An explicit conversion exists (are you missing a cast?)
What should i do for this ?
Hi Venkat Garu,
I am getting below issue .Even I add the Entity Framework from NuGet Package and Connection string also added to webconfig file also.
Even i add the Newtonsoft.Json Code to WebApiConfig .cs also.
Please give the solution for the below issue.
{"$id":"1","Message":"An error has occurred.","ExceptionMessage":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.","ExceptionType":"System.InvalidOperationException","StackTrace":null,"InnerException":{"$id":"2","Message":"An error has occurred.","ExceptionMessage":"Error getting value from 'Contacts' on
Why did you put it in a separate project?
Excellent series of videos but couldn't get the EmployeeDBEntities to work errors
When it displays Login failed for user sa when you access the api/employees in your browser, do the following:
1.Go to the web.config file in the solution
2. In the connection strings, make sure EmployeeDBEntities connection string is present
3. Locate the 'user id=sa' text on that line
4. If all above is done well, add a password field such as - password=(yourpassword)
5. It should look like "...;user id=sa;password=orangebananas;..."
6. Rebuild the solution and test if it works
Can we Do this without ado.net I need to implement We ApI. using sql commands,and return type only json
Any suggession please
Hello, I followed all the steps mentioned in the video but I get below error"
The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'.
System.InvalidOperationException
I tried with solution in WebApiConfig file in Register method
config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"))
OR
var json = config.Formatters.JsonFormatter;
json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;
config.Formatters.Remove(config.Formatters.XmlFormatter);
Also in Global.asax file in App_start event
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);
but even after all these solution I am still getting the same error. Can u help me to resolve this issue.
why using "EmployeeDataAcces;" not showing??
me too ....if you have the solution send to me
You have to add the reference first on the EmployeeService > Add> Reference > Projects > Select EmployeeDataAccess
When adding the WebApi 2 Controller i keep getting an error that says "There was an error running the selected code generator: 'Could not load file or assembly 'EmployeeDataAccess.dll' or one of it's dependencies. The system cannot find the file specified.'
Hi, thank you for this tutorial.
After rebuilding my solution I keep receiving 2 errors that I can't figure out how to solve.
I already looked at the comments and try them out, but it seem not to work for me.
Here's the error output:
1>------ Rebuild All started: Project: EmployeeDataAccess, Configuration: Debug Any CPU ------
1>C:\Users\MyName\source
epos\EmployeeService\EmployeeDataAccess\EmployeeDataModel.Context.cs(28,30,28,38): error CS0246: The type or namespace name 'Employee' could not be found (are you missing a using directive or an assembly reference?)
2>------ Rebuild All started: Project: EmployeeService, Configuration: Debug Any CPU ------
2>CSC : error CS0006: Metadata file 'C:\Users\MyName\source
epos\EmployeeService\EmployeeDataAccess\bin\Debug\EmployeeDataAccess.dll' could not be found
========== Rebuild All: 0 succeeded, 2 failed, 0 skipped ==========
I would really appreaciate your help!
Melinda Reiz
既に解決済みかもしれませんが、一度ソリューションビルドを実行してから再度試してみてください。
Hey, What is the second part of this tutorial?
Why choosing both MVC and Webapi both while creating webapi. application
Great tutorial!
Severity Code Description Project File Line Suppression State
Error CS1674 'EmployeeDBEntities': type used in a using statement must be implicitly convertible to 'System.IDisposable' WebApplicationdatabase C:\Users\DELL\source
epos\WebApplicationdatabase\WebApplicationdatabase\Controllers\EmployeeController.cs 15 Active
please sugget
@@kalpanatomar5987 Same error here. I know it's a year later but do you maybe remember if you could fix this? If so, do you know how?
While creating the controller, I am not getting the Employee keyword (that was used between the anchor tags in the Enum)
Hello, I wanted to know if you can explain how to add an existing database or application to this. I have been trying but with no luck
I have a question without get method mentioned in the uri how it goes to get method in the employee controller "
"api/employees/1" - only controller method but no method mentioned please tell me. thanks in advance.