Posts Tagged ‘Visual Studio’
Visual Studio‘s Navigate To window (Ctrl+,) is a very fast way to navigate in your files, classes etc. Few days ago I accidentally found a “feature”. I always started typing with first letter in upper case and after few characters I messed it up by typing letter in wrong case and missing object I was looking for. I was trying to find a way to make it do the search case insensitively.
And it’s actually pretty easy. As long as you type using lower case, it’s case insensitive. Using upper case once, turns it to case sensitive mode. No settings needed. Easy. I like it.
More than a year ago I wrote about tab closing button in Visual Studio 2010 making me crazy. I still don’t know whether the new placement is better or not. But it’s same as in the most common tabbed applications – browsers. Probably in some scenarios it’s better to have it in fixed place in upper right corner and other scenarios fit better for placing it to the tab.
Anyway I’m using Visual Studio 2010 as my daily environment for almost a year and I got used to it. The problem now is exact opposite. Working in Visual Studio 2008 I’m instinctively moving my mouse near to the tab I’m going to close instead to the upper right corner.
As the Visual Studio will move forward, we’ll probably forget about the old placement. Of course up until some UX designer will move the button to different place.
The ADO.NET provider for Firebird now fully supports all the new features in Entity Framework 4. Simple. If you’re eager to test it, grab the weekly build and enjoy.
We support the internal improvements as well as the visible changes like i.e. Model First or CreateDatabaseScript method. The template for creating SQL script is now part of sources and sure will be included in final package as well. I expect to improve it on your feedback and also the model generation from designer is pluggable so you can create custom one and use it there.
To support some new features in SQL generation I had to tweak it little bit and as with every change, there’s a change that something goes wrong. Thus I would be more than happy to get some feedback either that it works OK or any queries where it fails.
I’m so happy to cross this milestone about two months after final Visual Studio 2010, .NET Framework 4 (incl. Entity Framework 4) were released. You can expect the official release after some testing, it’s your turn
.
The VMWare Workstation had a problem with Visual Studio 2010 rendering (in fact all WPF apps were affected) when the hardware graphic acceleration was turned on. But since version 7.1 this is no longer true.
Recently I updated my virtual machine (VMWare Workstation 7.1 + new VMWare Tools + turning graphic acceleration on) with Visual Studio 2010 and the rendering is correct. Finally I’ll enjoy the graphic card accelerated machine and lighten up CPU.
The T4 templates are great tool for use. You can generate literally anything with it with comfort of using any .NET code you have available. Code generation (i.e. POCO classes in EFv4), web service proxies, simple DALs, …, all easily available.
But what if your scenario is one step further? You don’t want to use T4 template to generate i.e. code you’ll later compile into your application, but use the T4 template in runtime to generate result your application will later use (i.e. email based on template). Good news is you can do it, and it’s not hard either.
Easiest way is to start with Preprocessed Text Template file type adding to your solution. The file itself is ordinary T4 template you’re familiar with. But if you build your project the result produced isn’t output from template, but the C#/VB code that produces the result if called. Same result can be done by changing Custom Tool into TextTemplatingFilePreprocessor in Properties window of your current T4 template file.
Then you can create instance of this class (it has same name as your template file), setting up properties, if any and calling TransformText method. Pretty easy, isn’t it?
As it may look like nothing is going on, it’s not true. Next to Firebird 2.5 new protocol features, I’m also working on Entity Framework v4 support. Before I go further, be sure, that all providers written for Entity Framework v1 are also working with v4.
In fact right now all the major improvements in Entity Framework v4 are supported. You can benefit from features available, like the LIKE translation support or plenty of new functions. My personal favorite is TruncateTime (so I can get rid of workaround). The Model First approach is next in a row. At least basic T4 template for start is my aim. The rest could be done by you, simply modifying the template. And also wiring the template into code so you can use it programmatically too. Under the cover, while working on new stuff I’m also finding ways to optimize the code. Luckily the changes will be noticeable.
The DDEX for Firebird supports Visual Studio 2010 and the full Entity Framework v4 support will be here soon – now you can try a weekly build. Feel free to ask about anything related.
I remember from old times that I was using some plug-in into Delphi IDE to set tab order by clicking on components in order you wanted the ordering to be. Today I was reviewing the tab ordering in ID3 renamer as somebody reported in forum it’s wrong. I was scared doing all the work through Properties window in Visual Studio.
But it turned out, that Visual Studio has this tool in the box. You can find the description here. You’ll simply select form, go to View > Tab Order and click on different controls to change the ordering. You see the numbers directly in designer and go through possible options by clicking.
Pretty nice, don’t you think?
I’m using a lot of features from Entity Framework. In fact I think sometimes I’m abusing some features or pushing these to limits. Due to this, I’m often using designer as well as directly editing the XML (maybe if I could do “Update Model from Database” I would use XML almost all the time). But it’s a pain to be forced to close the designer when opening the file in XML Editor and vice versa.
Luckily there’s a solution. Open another instance of Visual Studio, there open the file in one “view” and the other “view” open in your solution as normal. When you change your file in one instance, the Visual Studio on the other will detect it and you can reload the file.
This will save me (and hopefully you) couple of unneeded clicks.
Some time ago I was writing about not supported scenario when you have entity with complex type and you want to map result of stored procedure to this entity. I couldn’t believe that this, from my point of view fairly common, scenario will not be supported in designer in RTM.
Right now I’m running RC of Visual Studio 2010 (the development probably in feature freeze mode) and the limitation is still there.
Jeff Derstadt was absolutely right, unfortunately. Although Zeeshan Hirani in forum said, he was able to do it manually, it’s uncomfortable. Same as complex types in EFv1.
Looks like complex types, sadly, are still not first class citizens for designer.
I like the idea of complex type. Sadly the designer didn’t supported complex types in EFv1/VS2008, although you could use it manually editing the model (it’s just a XML file). The designer in EFv2/VS2010 supports complex types (and you can use it also with EFv1, see this) hence it’s time to start really using these.
Unfortunately nothing is perfect. As far as you don’t wanna map some stored procedure result to collection of entities, then the designer will tell you, that it’s not supported.
And Jeff Derstadt pointed in forum that this limitation will not be solved in RTM.
I’m using EFv4 in my current project and thanks to ability to map functions directly to LINQ functions via EdmFunction attribute I was able to to a lot of work via functions and queries created by EF itself. But I always feel a little bug in my head saying “What if you’ll need it later?”. Sure I can redo all back into direct properties, but if it’s close to the end of the project it’s pretty expensive to do it.
What a pity, I see complex types as a good concept, but I’m too careful to close myself the path with SPs.
In March I wrote about one of the new features in Visual Studio, time being called Quick Search. If you look into VS2010 Beta 2 (current latest) you may be confused as there’s no function called like that. Now it’s called Navigate To. Luckily the shortcut is untouched – Ctrl+,. So if you wanna give it a try, look for this new name (or use the good old shortcut).
Nová verze Entity Frameworku už pomalu klepe na dveře a proto není od věci podívat se, co nového nabídne. V rámci přednášky na MS Festu projdu největší změny a vylepšení. Rozhodně je na co se těšit – pokud již EF používáte, tak na ulehčení života a pokud ještě ne, tak na ještě větší lákadla jej použít. A vzhledem k plánované večerní akci bude prostor i pro kuloární diskuze, nejen o EF.
I recently migrated from VPC to VMWare Workstation. So far all looks good only one problem I faced two days ago. When I run Visual Studio 2010 (Beta 2), the menu rendering was odd, text in code editor was disappearing and so on. After some searching I found, that it may be caused by 3D graphics acceleration turned on in VMWare Workstation. Surprisingly you have to turn it off – either in system, setting DisableHWAcceleration in registry (it’s for WPF) or unchecking the 3D acceleration in VM’s settings. After this adjustment (my choice was the VM level, as it may be improved later and it’s IMO easier to turn it on), all works great. I hope when the RTM of Visual Studio 2010 will be released, this will work as expected.
I finally got my hands on the new feature in EF4, Code Only. It’s now available in feature CTP. What’s the code only? Very shortly you write just a code and express your mapping in code as well. There’s no model, no edmx file, no CSDL, MSL, SSDL files.
The current version is pretty limited, it’s more preview than something you can do some work with (which I wasn’t aware of and I was little disappointed). You can read more about what will be available on http://blogs.msdn.com/efdesign/archive/2009/06/10/code-only.aspx, http://blogs.msdn.com/efdesign/archive/2009/08/03/code-only-enhancements.aspx and http://thedatafarm.com/blog/data-access/next-version-of-ef-code-only-design-laid-out-by-ms/.
I mainly wanted to try it on a non standard (read: not “follow this demo”) MS SQL database and on Firebird as well. The first bad news is, that current CTP supports only SqlClient. And probably some following previews will too, as the other providers model will be built on top of it (but I’ll try to push this as much as I can, to see some Firebird demo soon). The other is, that the currently available version is limited, even features in first Code Only blog post are not working.
Right now you can only create a context and use it for work with all defaults – default names for tables, default mapping etc.
using (SqlConnection conn = new SqlConnection(@"Data Source=.sqlexpress;Initial Catalog=testovaci;Integrated Security=True;Pooling=False"))
{
ContextBuilder<COContext> builder = new ContextBuilder<COContext>();
COContext context = builder.Create(conn);
string script = context.CreateDatabaseScript();
context.Masters.ToArray();
}
Nothing special. If you try it with FirebirdClient, you’ll get NotSupportedException immediately. Dammit.
using (FbConnection conn = new FbConnection("database=localhost:rrr.fdb;user=sysdba;password=sysdba"))
{
ContextBuilder<COContext> builder = new ContextBuilder<COContext>();
builder.Create(conn);
}
Despite the frustration I found couple of new interesting extension methods (in Microsoft.Data.Objects, also ContextBuilder sits there). One of these is CreateDatabaseScript. This method works not only with Code Only created ObjectContext, but on every ObjectContext. So you can create your database creation script during runtime even if you’re using i.e. EDMX file easily. I’m also seeing great opportunity for this with Code Only setup during runtime. You can have different builds with different setups and create script for users based on selection. And by the way, there’s also CreateDatabase method available. But again right now works only with MS SQL only. But I know other databases will be supported as well, I have tested some pieces already.
I like the Code Only feature, maybe more than Model First (probably because I’m using ERD tools to model my databases). And I’m looking forward to see more progress on it, and also the model for 3rd party providers.
The new Visual Studio 2010 looks. I’m more interested in .NET FW 4.0 and C# 4 new features, but some of the new stuff makes me happy to. But one new function makes me crazy. The editor tabs has now the closing button on each tab. Similar to what browsers have. But I’m used to look at it in upper right corner. And every time I’m about to close a file using a mouse, I’m starting to move wrong way. I hope to get used to this new feature or have some option to turn on the old behavior.
I’m happy to announce, after about 47 000 000 seconds of thinking and development, release of FirebirdClient 2.5. This new shiny release contains couple of very interesting new features:
- Implementation of Firebird 2.1 protocol improvements. These improvements are focused on making the communication more efficient on slow and with high latencies networks like the internet.
- Entity Framework support. Entity Framework is new, rich OR mapping and modeling tool, sitting on the top of ADO.NET. It is store agnostic, using ADO.NET provider to work smoothly, and the FirebirdClient has now build-in support for it.
- Windows integrated auth. Firebird server is now able on Windows to authenticate users using a system (ActiveDirectory, etc.), and when you omit username and password FirebirdClient will try to negotiate with server this kind of authentication.
- Timeout for wait transactions.
Of course, this release contains also lot of bug fixes and performance improvements. You can see the most important on http://tracker.firebirdsql.org/sr/jira.issueviews:searchrequest-printable/temp/SearchRequest.html?&pid=10003&fixfor=10170&fixfor=10340&fixfor=10261&fixfor=10240&fixfor=10230&status=5&status=6&sorter/field=issuekey&sorter/order=DESC&tempMax=1000. I’m also happy to say, that we have again full set of builds available for download. You can download build for .NET 3.5 (and unit tests), .NET 2.0, Compact Framework, Mono (Linux build) and also ASP.NET web providers.
One of the early adopters, SMS-Timing, of Entity Framework support for Firebird comments:
“Thanks to Jiri’s (link) work the Firebird .NET Data Provider made a lot of progress and is now even supporting the Entity Framework. Because of the adaptations we were able to use the newest .NET technologies in a modern programming environment together with a well known Firebird Database. In our industry (entertainment) the customers expect new and exciting software, and therefore the development tools need to be cutting edge. These developments in Firebird have a big impact on our products, and we hope that it brings the same boost to the Firebird Community itself. A preview of our newest software: www.fast4thefuture.com, http://www.sms-timing.com/en/software_kiosk.php.”
You can download the new version on http://www.firebirdsql.org/index.php?op=files&id=netprovider.
I’m glad to announce Beta 2 release of FirebirdClient 2.5.0.
This release contains implementation of new Firebird 2.1 protocol,
couple of bugfixes in Entity Framework support and other bug fixes and
improvements.
Thanks SMS-Timing for support on new protocol and Entity Framework support and Vlad Khorsun for answering all my questions on new protocol.
Download on http://www.firebirdsql.org/index.php?op=files&id=netprovider.
For more information about this release visit:
http://tracker.firebirdsql.org/secure/ReleaseNote.jspa?version=10340&styleName=Text&projectId=10003
for detailed changes follow the SVN log or visit:
http://tracker.firebirdsql.org/browse/DNET?report=com.atlassian.jira.plugin.ext.subversion:subversion-project-tab
I’m not kind of guy hungry for thousands of new features in my current development IDE. In fact I’m happy for decently smart editor, because my work mainly involves BL etc. But couple of new features in new Visual Studio 2010 I really like.
One is called Quick Search. It simply allows you to find a lot of stuff from simple window – files in solution, methods etc. And it’s smart too. If you have file named, let’s say MyCoolClass.cs, you can type just MCC and the file will be found too. Nice, isn’t it? Almost as fast as navigating in text in VI editor.
And other is called Call Hierarchy. It’s simple tree showing you who is calling selected methods and vice versa. You can easily traverse through this tree and see paths where your code is going. And you can of course navigate to methods selected in the window.
Simple functions, but may help a lot. What is your favourite in upcoming VS or current VS maybe with some plugin?
If you want to map stored procedure you have three options what the stored procedure can return. Nothing, some scalar value and entity. The problem is that sometimes you have SP that’s returning some data, but not some entity. The way to solve this is to create entity with same shape as the SP is returning. But the problem is, that this entity type needs to be mapped to something, probably table. Else the model is not valid. The good message is, that you can create fake table in SSDL and use it.
But it’s a pain to create it, because you have to deal with XML directly and create not only the fake table with proper structure, but also entity set. When reading pre-prelease
version of Julie Lerman‘s wonderful book Programming Entity Framework there was a sigh about some tool to automate the process. Well today I have some time, to create rough tool to create some kind of this tool.
static void Main(string[] args)
{
#region Initial checking
if (args.Length != 3)
return;
string tablenameToFake = args[0];
string emdxFile = args[1];
string fileForSaving = args[2];
if (!File.Exists(emdxFile))
return;
if (File.Exists(fileForSaving))
return;
#endregion
XDocument xdoc = XDocument.Load(emdxFile);
const string CSDLNamespace = "http://schemas.microsoft.com/ado/2006/04/edm";
const string SSDLNamespace = "http://schemas.microsoft.com/ado/2006/04/edm/ssdl";
XElement csdl = xdoc.Descendants(XName.Get("Schema", CSDLNamespace)).First();
XElement ssdl = xdoc.Descendants(XName.Get("Schema", SSDLNamespace)).First();
XElement csdlItem = csdl.Elements(XName.Get("EntityType", CSDLNamespace))
.Where(x => x.Attribute("Name").Value.ToUpperInvariant() == tablenameToFake.ToUpperInvariant()).FirstOrDefault();
if (csdlItem == null)
return;
Func<string, string> getStoreType = (string csdlTypeName) =>
{
// Use some information from store provider or use some dummy or extend this switch using common SQL names?
switch (csdlTypeName)
{
case "Int16":
case "Int32":
case "Int64":
return "int";
case "String":
return "varchar";
default:
return "blob";
}
};
#region New EntityType creation
XNamespace n = SSDLNamespace;
XElement tableToFake = new XElement(n + "EntityType", new XAttribute("Name", tablenameToFake));
var keys = from x in csdlItem.Element(XName.Get("Key", CSDLNamespace)).Elements(XName.Get("PropertyRef", CSDLNamespace))
select new XElement(n + "PropertyRef",
new XAttribute("Name", x.Attribute("Name").Value));
tableToFake.Add(new XElement(n + "Key", keys.ToArray()));
var columns = from x in csdlItem.Elements(XName.Get("Property", CSDLNamespace))
select new XElement(n + "Property",
new[] {
new XAttribute("Name", x.Attribute("Name").Value),
new XAttribute("Type", getStoreType(x.Attribute("Type").Value)),
new XAttribute("Nullable", (x.Attribute("Nullable") != null ? x.Attribute("Nullable").Value : "true"))
});
tableToFake.Add(columns.ToArray());
#endregion
#region EntitySet for new entity
XElement someEntitySet = ssdl.Element(XName.Get("EntityContainer", SSDLNamespace)).Element(XName.Get("EntitySet", SSDLNamespace));
XElement newEntitySet = new XElement(someEntitySet);
newEntitySet.Attribute("Name").Value = tablenameToFake;
newEntitySet.Attribute("EntityType").Value = ssdl.Attribute("Namespace").Value + "." + tablenameToFake;
#endregion
ssdl.Add(tableToFake);
ssdl.Element(XName.Get("EntityContainer", SSDLNamespace)).Add(newEntitySet);
using (XmlTextWriter writer = new XmlTextWriter(fileForSaving, Encoding.Default))
{
xdoc.WriteTo(writer);
}
}
This code simply looks for entity you specified and makes the appropriate items in SSDL. It’s very rough, especially datatypes for table are scamped
, but you can extend it youself with your favourites. Or maybe better use some information from store provider. Anyway the basic idea is here, if you extend dataypes, it will work well for this stuff. Mapping should be done by you in designer, although because column names are same as entity’s, you only need to choose right table name, rest will be done by the designer. And of course, when updating model from database, these changes are lost.
Comments are welcome.
I’m pleased to announce 2.5.0 Beta 1 for .NET 3.5/2.0 [with Entity
Framework support] version. It contains several bugfixes as well as
brand new Entity Framework support (still beta!). Looking forward to
your feedback.
Binary as well as sources can be downloaded from
http://www.firebirdsql.org/index.php?op=files&id=netprovider.