Andres Aguiar's Weblog

Just My Code

May 2006 - Posts

The news are out - ADO.NET 3.0 Entity Framework

It went unnoticed in the PDC, but the news are finally out.

There's another data mapping technology from Microsoft, this time from the ADO.NET team.

The announcement in the ADO.NET team blogs .

I think the approach it's much better than any other previous attemps to tackle the problem. For example, they realize that the Product Price/Description belongs to the Order 'view' in addition of belonging to the Product class!

Of course, that matches the way we see the world in DeKlarit:

More Cool Visual Studio Commands

Gaston did it again, and the new VS Cool Commands make my life much easier.

 

Posted: May 11 2006, 01:16 AM by aaguiar | with no comments
Filed under:
DeKlarit 4.0 Released - CAB, WSE, VS2005, SQL2005, Layouts & More!

Last week we released DeKlarit 4.0.

I won't post the new feature list here, as you can read it in the website. What I will do is tell you about my favorite new features ;).

Gaston built a great platform-independent layout editor. We can now generate very sophisticated forms in Windows Forms or ASP.NET using the same metadata.

We added support for the Composite Application Block (and EntLib 2) which makes possible to customize DeKlarit generated Windows Forms applications without modifying the generated code.

Thanks to ASP.NET 2.0 great support for custom datasources, we can expose the full power of the generated business logic layer very easily to ASP.NET with a DeklaritDataSource. Most of the credit here goes to the ASP.NET team, as writing the DataSource is not that hard.

For SQL generation fans, we now can page hierarchical unnormalized views very efficiently. Let's say you want to retrieve the second page of the orders, including its order lines, and in the Orders headers you want to retrieve some fields from the Customers and Employees tables (but not all the fields), and in the Order lines you want to retrieve some fields from the Products table. We will execute two SQL sentences, here in its SQL 2005 syntax:

SELECT * FROM ( SELECT  TM1.[OrderID], T2.[CompanyName], TM1.[OrderDate], T3.[FirstName], TM1.[RequiredDate], TM1.[ShippedDate], TM1.[Freight],
TM1.[ShipName], TM1.[ShipAddress], TM1.[ShipCity], TM1.[ShipRegion], TM1.[ShipPostalCode], TM1.[ShipCountry], TM1.[CustomerID], TM1.[EmployeeID],
TM1.[ShipVia], ROW_NUMBER() OVER (ORDER BY TM1.[OrderID] ) AS DK_PAGENUM   FROM ((dbo.[Orders] TM1 LEFT JOIN dbo.[Customers] T2 ON T2.[CustomerID] = TM1.[CustomerID]) LEFT JOIN dbo.[Employees] T3 ON T3.[EmployeeID] = TM1.[EmployeeID])  ) AS DK_PAGE WHERE
DK_PAGENUM BETWEEN 81 AND 160

SELECT T1.[OrderID], T3.[ProductName], T1.[UnitPrice], T1.[Quantity], T1.[Discount], T1.[ProductID] FROM ((dbo.[Order Details] T1 INNER
JOIN  ( SELECT * FROM ( SELECT TM1.[OrderID], ROW_NUMBER() OVER  ( ORDER BY TM1.[OrderID]  ) AS DK_PAGENUM   FROM dbo.[Orders]  M1) AS DK_PAGE WHERE
DK_PAGENUM BETWEEN 81 AND 160)  TMX ON TMX.[OrderID] = T1.[OrderID]) INNER JOIN dbo.[Products] T3 ON T3.[ProductID] = T1.[ProductID]) ORDER
BY T1.[OrderID], T1.[ProductID]

As you can see, the nested level joins with the right page of the upper level so it just retrieves the children rows for the headers retrieved in the first query.

This works for any number of hierarchical levels,with simple and compound primary keys, including filtering conditions in each level. I have no doubts that some .NET code generators/O/R mappers support this, but I'm pretty sure most of them don't ;).

 

Medium Trust

As I blogged previously we had some issues to make EntLib 2.0 in Medium Trust. It was not the only one.

The most annoying one was that TypeConverters do not work! I found this thread in the MS newsgroups that confirmed it.

This is really an important restriction for ASP.NET control vendors, I'm not sure how they manage to work in medium trust. In our case we could change our implementation and use a custom TypeEditor in design-time.

Another one is that you cannot use OleDb, so using Access is not possible.

Of course everything works if you put the offending assemblies in the GAC but that was not an option ..

EntLib 2.0 and Medium Trust

We needed to make EntLib 2.0 work in medium trust scenarios. Unfortunately, it does not work out of the box. The EntLib team is working on a new build that will fix it, but meanwile I wanted to share what we needed to do.

We are basically using the Caching, Authorization and Encryption block.

To make it work, we had to remove most the permission demands form the AssemblyInfo.cs files. The only permission that can be declared without complains on build time is the [assembly: SecurityPermission(SecurityAction.RequestMinimum)]

FileConfigurationSourceImplementation fails because it tries to open machine.config and it's not possible. We did not find a workaround, so we stopped using FileConfigurationSource.

In the web.config <configSection> section you need to add the 'requirePermission="false"' to each entry, like:

<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=2.0.0.0, Culture=neutral, PublicKeyToken=387f38cffbc45540" requirePermission="false"/>

With these changes we made it work.

I hope it helps someone.

MindManager, Requirements and Wikis
The MindManager people are working on a cool tool for VSTS.

I think it's a good idea, but when I was trying it I felt that I was doing something similar to what I do when I start writing ideas on our internal Wiki in the sense that I have a tree of related documents, that can be represented as a set of Wiki pages, and in each leaf there's probably a document describing the feature. In their tool they have a text editor to create it, but it would be much better if it was a Wiki page.

On the other hand, is much easier to edit and visualize the mind map than a set of Wiki Pages.

It would be great if we can mix both worlds and have an editor for wiki pages lets you visualize them and edit them as a Mind Map. If someone knows of such a tool, let me know!

 

More Posts