|
Hello everybody. I'm asking for help in learning how to use this new MS product. As a developer of mainly LOB apps, I'm always interested in new ways to avoid the boilerplate code that's common when dealing with data layers. Except that after a few days dealing with EF4 I'm not finding any improvement, it seems to stomp on my feet on every basic real world requirement.
I read about model-first design and I found it a step in the right direction. So I built a simple model:
Customer <-> Order <-> Item
Built the associations and generated the MSSQL database. Nice!
Oops, it creates all fields as varchars. Right, I didn't tell him that the field OrderDate is a Date, so I change that and regenerate the script. Mmm? Drop table? I have to generate the ALTERs by hand?
Google and find the (beta) tools[^] to update my database automatically. This works, though I have to admit I only tried simple changes.
Fire up some tutorials. Learn about the different related windows in VS2010. Next lesson: entity splitting. I follow the tutorials and try to create a separate CustomerAddress entity, which I later merge into Customer. Seems to work, save and generate the DB scripts: the CustomerAddress entity is gone from the DB and the fields are merged into Customer, even without using the ALTER script power pack. WTF?
Ok, maybe entity splitting isn't so useful in real life, I can live with two separate entities and manual joins. Let's get back to studying the model. I see that by default it generates properties for the entity keys. I don't need them, recreate the entities to delete them (I didn't find any other obvious way). Regenerate the DB.
I notice that the FK columns are generated with a standard name: <ENTITYNAME>_<KEYNAME>, in my case the ugly Customer_CustomerId. I decide to change it into my familiar id_customer, and fail to find a suitable command. The properties window shows the name as readonly, the Mapping Details window doesn't let me specify another name, F2 does not do anything. It's readonly. So I take an axe and drill down into the edmx XML. Find/Replace seems to work, the model now seems ready to kick off a simple application and test queries. I only need to generate the DB... and it reverts my manual changes! Fields name are back to Customer_CustomerId! WTH!?
There must be some missing piece in my head. Am I doing something wrong? Is my VS installation borked? Does it work for you? Anybody took something in production using EF? How do you maintain an app without any machine help? Does it save even a minute over hand-crafted ADO.net data layers?
Thanks
Luca
The Price of Freedom is Eternal Vigilance. -- Wing Commander IV
En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur.
(But the best thing God has created, is a New Day.)
-- Sigur Ròs - Viðrar vel til loftárása
modified on Monday, October 18, 2010 6:56 PM
|
|
|
|
|
I have a TCPListener object. TcpClient connects with it. Client sends data to it. It read data from networkstream by using GetStream() method of tcpclient. If I will call GetStream() method 2 times with same object then will it return same stream or different stream? Should I use ref keyword if I want to pass this networkstream or tcpclient?
My actual problem is that I am able to read from client but I am not able to send data to client.
modified on Saturday, October 16, 2010 3:35 AM
|
|
|
|
|
It will always return same Stream; I just completed my testing.
And my problem is also solved now.
|
|
|
|
|
Hi guys, in my project i use typed date set. I store customer image in SQL and I use Grid View to show database informations.But the problem is, size of the grid view row.I want to change the size to view images . Is any one know how to do it?????????
|
|
|
|
|
Change the row height as shown here[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
I have Gridview with Label controls. When I click on linkbutton on top of the grid new row with Textbox control to be added to the Gridview. How can I get this.
|
|
|
|
|
Have you tried to find about something what you want in web?
Just type search keyword "asp .net gridview add new row" in google, you will get satisfaction that you done without anybodys' help.
|
|
|
|
|
If I search with the keyword "asp .net gridview add new row" in google, Controls which we design in the Gridview get added but I want to add text box for New row and Labels for existing data. Hope nobody post here with out browsing in the web. Mind your language.
|
|
|
|
|
|
Hi Guys, In my project i use Typed DataSource. I am new to .NET, i want to filter my data from
SOL database. My SQL Table contains StudentName and StudentID. I want to retrive student name using his/her id, but i dont know how to do it...
|
|
|
|
|
|
Hi All,
I have an existing VS 2005 c#.NET application created. What I want to do is add spell check functionality to the RichTextBox fields etc. I read that .NET Framework 3.5 and 4.0 have a built-in spell checker.
I downloaded and installed .NET Framework 4.0 and already had 3.5 installed on my Windows XP SP3 machine.
The problem I'm having is when I right-click "References" in VS and choose "Add Reference" I don't see the option "System.Windows.Controls" in the .NET list, which is where I believe the SpellCheck control can be accessed from.
Is there a way for me to change the default .NET Framework used by VS 2005 to .NET Framework 3.5 or 4.0?
Any help with this would be really appreciated.
Thank you,
Mel
|
|
|
|
|
Hi,
1.
there must be several solutions for spell checking in .NET; did you search any? Here[^] is one of the relevant CP articles.
2.
The original Visual Studio 2005 was the last edition targetting a single .NET framework version (2.0); with extensions for 3.0 it also targets 3.0; it takes VS 2008 or 2010 to target multiple frameworks, however never a more recent one than the VS edition itself.
|
|
|
|
|
Yes I did carry out several searches before posting this question, that is how I found out that the .NET Framework 3.5 and 4.0 have a built-in spellCheck control. Thanks for the link I will take a look at it.
I also have VS 2008 installed on my machine Win xp SP3, and the target .NET Framework there is 3.5, however, I still don't see System.Windows.Controls when trying to add a reference. Do you know the reason for this?
Thank you,
Mel
|
|
|
|
|
I don't know.
Does this[^] help? As always, MSDN documentation mentions namespace and DLL name.
|
|
|
|
|
Thanks for the reply Luc. That's funny, that was the site that I origionaly got from information from. I'll take a closer look to see if I can get any more out of it.
|
|
|
|
|
First of all - the framework doesn't have built in spell check functionality. The WPF textbox provides this functionality.
Secondly, you can't target post .NET 2 from VS 2005. You can always download something like Visual C# Express 2010 if you want to use a later version of the framework.
Alternatively, you can download and use nhunspell (there are articles here on Code Project about this).
|
|
|
|
|
Ha, thanks for that Pete, so my problem with VS 2008 is that I haven't added the PresentationFramework.dll I assume.
|
|
|
|
|
I'm going to read up nhunspell thanks. Would you recomend this over the WPF textbox functionality?
|
|
|
|
|
|
Thanks. I'm sorry but what are the benifits?
|
|
|
|
|
The built in spell checker is limited in the choices of languages it supports - it's not extensible. Contrary to popular opinion, it's not the Office spell checker. NHunspell makes use of the Open Office dictionaries and, if memory serves, it also allows you to perform Thesaurus functions.
|
|
|
|
|
Hi Pete,
Thank you for your feedback. I'm going to start working on incorporating the Hunspell functions into our code.
Thank you again,
Mel
|
|
|
|
|
|