April 22, 2010

DataObjects.Net v4.2.0 installers are updated

I decided to update v4.2.0 installers to the latest nightly build (from stable branch), since we’ve fixed a set of annoying bugs during last two week.So there is nothing new yet, just fixes. But if you're using v4.2 in production, it's highly recommended to update it.

As usual, the latest build can be found in Downloads area.

P.S. The publishing process isn't finished yet. Track the build date there, it will be changed when publication is finished.

April 19, 2010

Status update

I'm a bit late with my planned schedule for Xtensive.Practices - the end of the last week was spent mainly on bug reports (this month we have a very limited number of people working on DO4, since there is a temporary, but strong demand for them on other projects we run, so I was responsible for resolving part of reported bugs). I hope to finish planned works for ASP.NET and ASP.NET MVC during this week.

Another important news is that we're going to show DataObjects.Net 4.3 RC on the next week:
  • Migration to PostSharp 2.0 is already finished. This was the most complex part, since new APIs are quite different to the old ones.
  • We must migrate to .NET 4.0 & VS.NET 2010 now. Mainly this implies upgrade of .csproj files, a set of renames and few conditional compilation instructions. So as you might suspect, it won't be possible to build DO4 on VS.NET 2008 after this step, although we'll continue supporting .NET 3.5.
So stay tuned. If it will be possible, we'll try to show something related to VS2010 even on this week.

April 8, 2010

New ASP.NET MVC Sample update + screenshots

I just updated ASP.NET MVC sample described in my previous post:
  • I ripped out all the stuff that isn't directly related to usage of DO4 with ASP.NET MVC. Mainly, it was all the stuff related to login & user registration. I'm going to return back & update this part  when a generic security helpers will appear (to show the standard approach to this problem instead of one more example).
  • Paging is implemented for Persons list. This is really pretty simple with .Take & .Skip, although you must remember that it's not a good idea to use this approach for really large sets of large data (e.g. millions of rows - check out the plans produced for such queries). But... Since almost any grid uses exactly this approach, I bet almost no one cares about this ;) I'll show much more efficient paging later.
  • The sample generates 100K entities by default on its first start now - just to show that paging really works ;) This must take about 10 seconds on moderate PCs.
  • MVVM-like models are passed to almost all the views now. That's good from the point of design.
  • Finally, I extracted a lot of common stuff to Helpers. They handle almost everything related to errors, messages and even web site title and header.
Finally, I created a set of screenshots showing various aspects of this sample and shared them in Picasa. Here they are (as slideshow):

As usual, all the changes are already @ Google Code. Today's nightly build will include this sample as well.

New ASP.NET MVC Sample

I just pushed new ASP.NET MVC sample for DO4 to Google Code - actually, that's my today's attempt to create a new ASP.NET MVC application from scratch and try to efficiently use DO4 there.

So far the sample is really simple:
  • It is based on default ASP.NET MVC application template;
  • But there is a new PersonController, views and test for it. So it's possible to view, create and remove Persons there.
The sample shows how to:
  • Handle DataObjects.Net model validation errors: you must notice I don't use ASP.NET validators at all there, so all the checks are performed by validation framework integrated into DO4. See Person.OnValidate() method - there is even a type-level check. Obviously, this doesn't mean ASP.NET MVC validation is incompatible with DO4 - you can enable it by simply adding data annotations to PersonEditModel.
  • Handle version conflicts. Try to edit the same objects in two browser windows.
  • Implement View Model <-> Business Model mapping (as far as I understand, usage of separate view model is recommended pattern for ASP.NET MVC). I used pretty simple approach here - in fact, all the mapping code is located inside PersonEditModel and its base type (EntityModel), but possibly, this is even better, since the sample is purely educational now.
  • Use transactions - both in ASP.NET MVC controllers and unit tests.
  • Rollback the transaction in case of errors. SQL Profiler will show that transactions are really rolled back in case of any errors. Btw, the same is true for tests.
That's all for now. Obviously, all this stuff is crude from the point of APIs (although I tried to make the code look nicer), but clear APIs is what I'm going to do during the next week. If you'll get any ideas related to possible improvements of this sample, please leave them in comments. 

Screenshots of this sample are shown here.

P.S. Yesterday I promised to write my ideas on ASP.NET MVC helpers - as you see, this part isn't completed yet. But I hard-coded a part of them :) Tomorrow I'll try to add an advanced grid to this sample - I want to evaluate the most important use cases first.

April 7, 2010

Intermediate info on upcoming post about ASP.NET MVC 2 helpers

In short, I've spent all the day reading about ASP.NET MVC 2 and watching videos related to it. So far I'm really impressed - although there are still some minor lacks (e.g. I hate strings in code), there is a quite solid and consistent model.

If I'd be choosing between ASP.NET MVC and classic ASP.NET for new web application now, I'd definitely use ASP.NET MVC.

I'm still thinking about possible helpers and samples we must provide for it. The post describing my thoughts will be published only tomorrow.

April 6, 2010

Why forced SQL statement caching isn't always a good option

Dmitri Maximov just sent me a link to an article perfectly explaining why forced statement caching isn't always a good option. "Forced statement caching" (sp_executesql or sp_prepexec) is frequently used in ORM tools as default query execution approach.

The subject of that article is related to DataObjects.Net - it has so-called boolean branchinf feature influencing on produced queries (and thus their cached query plans as well).

Xtensive.Practices, ASP.NET helpers

So I'm thinking about the following set of helpers to implement for regular ASP.NET:

1) SessionManager from Xtensive.Storage.Web.

If you don't know, this is an IHttpModule automatically providing Session for each web request. More details are described here.

But to consider this part completed, it must be extended to automatically attach a DisconnectedState to Session provided by it for a particular web request. This feature might be quite useful for long-running transaction scenarios - e.g. wizards, where actual database modification must be performed only on the final step, although the data is updated during all the steps there.

I'm thinking about the following syntax:
  • TData SessionManager.Demand().GetDisconnected<TData>(string key = null) where TData : class will attach cached DisconnectedState and deserialize cached data (of TData type) after doing this. If result of this call isn't null, it will be serialized & placed back to cache on successful completion of transaction.
  • SessionManager.Demand().SetDisconnected<TData>(string key = null, TData value) where TData : class will set the specified value. If null, the cached one will be removed.
2) Validator control (of course, server-side only) that automatically validates version of a particular object (i.e. performs an optimistic version check).

Not sure to which control these validators must be attached - probably, they must be attachable only to our special invisible controls identifying the object.

Any ideas are welcome here.

3) Paging helpers.

Actually I'm absolutely not sure if this is necessary at all - there are plenty of paging examples for LINQ like this and that, and any of them must work.

So may be we must just add something like IQueryable<T>.Page(int pageSize, int pageIndex = 0) extension method with its LINQ translator forwarding it to .Skip(...).Take(...) sequence? But AFAIK all the grids for ASP.NET that support LINQ are capable of adding this sequence automatically.

Thus... May be we must just show a sample here? Again, any ideas are welcome.

Please leave your opinions and requests in comments. The similar post for ASP.NET MVC will appear shortly.

April 2, 2010

Topics related to KeyGenerator in our support forum

The most current search results for "KeyGenerator" keyword: http://goo.gl/dVzp

This topic explains the concept pretty well.

Birth of Xtensive.PnP (patterns and practices)

The time has come :) I'm going to establish Xtensive.PnP (patterns and practices) solution in our repository on this week.

The idea behind this step is to separate use case oriented code to a set of "PnP" assemblies. I have the following layout of this solution in my mind:
  • Xtensive.PnP.dll will contain all the code dependent only on DataObjects.Net
  • Xtensive.PnP.Technology.dll will contain the code dependent on a particular technology, e.g. there must be Xtensive.PnP.AspNetMvc.dll for ASP.NET MVC 2.
So to start using a particular pattern, you must:
  • Add reference to the assembly implementing it
  • Register all the types from either the whole assembly or a particular namespace (if there are several patterns in this assembly) to DomainConfiguration.Types to enable its support.
What project are expected to be there? I imagine the following:
  • Web: helpers related to ASP.NET applications; initially there will be just SessionManager.
  • Wpf: helpers related to WPF applications. We must provide SessionManager analogue there returning Session for the current Window or its part (this is quite desirable in MDI case) and allowing to propagate the changes among them. This part will be based on more advanced WPF sample we're working on.
  • AspNetMvc: helpers related to ASP.NET MVC 2. Shortly I'll describe what I already have in mind here.
  • Wcf: helpers related to WCF. Such types as DisconnectedResult<T> and ModificationSet (from WCF sample) will be there.
  • Localization: reusable types from Localization sample.
  • Security: our security framework. Initially there will be just base types for Principal, User and Role + service managing all of them and a set of helper extension methods to Session object. Likely, ASP.NET Membership Provider will be there as well. ACLs will appear there a bit later - our initial goal is to provide a basic API that can be used.
My further PnP plans include:
  • Tagging: attaching tags to items is one of typical problems developers deal with, and we're going to help you a bit here - by providing a framework for this. The case here is very close to localization: we'll propose a working approach + some helpers (may be, query preprocessor - I'm not sure for now) simplifying usage of this API.
  • Sync: most likely it will be implemented as PnP pattern as well.
  • Undo-redo: "redo" support is already provided - it is our Operations framework used by DisconnectedState. So here we must add undo operations logging support (by nearly the same way) and add few helper types allowing to persist these info for each executed transaction and study it later.
  • Multitenancy: if you're developing a SaaS application, you must think how to scale it up. So this pattern must help to solve this issue. Base tenant type (with arbitrary key), service and Session extensions allowing to specify current tenant, domain module that automatically adds either a reference to tenant type (or its key fields) to the beginning of each primary key and index, query preprocessor automatically injecting tenant-related constraint to any query and service automatically providing Domain for a particular tenant based on its hash is the implementation plan I keep in mind here.
  • Something else? Your ideas are welcome.
I'm going to implement PnP project mainly by my own forces:
  • Although each of these projects seems pretty complex, its complexity is mainly related to design and the way of integration with DO4, but not the amount of code (from this point all the projects must be relatively simple). So it's a good task for framework architect.
  • This might help me to gather more information related to practical usage of DO4.
And, what's more important, I'd like to involve you in this process. Currently I have the following implementation plan:
  • I'll work in 2 week iterations; so almost any of PnP projects will require 2 or 4 weeks.
  • First week in each iteration will be spent on gathering requirements and samples. To maintain a discussion, I'll create a topic in feature requests forum for each feature (PnP project) planned to be implemented in this iteration, where I will describe the features I keep in mind and will discuss the exact implementation with you. I'd be glad to hear any ideas on proposed or additional features.
  • By the end of first week I'll make final decision on actual implementation, as well as on implementation time.
  • The actual work on implementation will be started on the beginning of the second week. If any issues will be faced there, I'll talk about them with you.
  • When feature is implemented, it will immediately appear in the nightly build (possibly, this will be done even earlier). So it will appear in release after some period of testing.
  • Documentation for each feature will be written during next feature's spec. duscussion phase.
Finally, here is my plan for the next 4 weeks:
  • April 5 - April 11: discuss features for Web, AspNetMvc and Localization PnP projects and migrate existing code to PnP solution. The only new project here is AspNetMvc project, so that's why they come together. Goal of this phase is to develop ASP.NET and ASP.NET MVC samples utilizing binding, error handling, versions (optimistic locking), validation, paging and DisconnectedState (e.g. for wizard).
  • April 12 - April 18: implement the decisions.
  • April 19 - April 25: discuss features for Wpf and Wcf projects. I intentionally want to wait with this, since Denis Krjuchkov is working on new WCF sample now. Goal of this phase is to develop N-tier and regular samples utilizing data binding, error handling, versions (optimistic locking), validation, paging and, obviously, DisconnectedState. Likely, we'll start discussing all the stuff here immediately when it's done; moreover, corresponding projects will appear in PnP solution shortly after appearance of new sample. But since I'd like to have a realistic plan, let's schedule this for 3rd week for now. If the time will permit, we'll go faster.
  • April 26 - May 2: implement the decisions.
  • Having this done, I'll switch to Security.
If you have any ideas on possible improvements for the proposed process, feel free to share them in comments.

P.S. It seems I'm the only person @ Xtensive writing absolutely serious posts today. Hopefully, you already have got enough smiles during April Fools' Day :)

Topics related to DisconnectedState in our support forum

I made search for "DisconnectedState" keyword in our support forum. Since this feature is poorly documented yet, I hope this information will be helpful, if you're trying to use it.

Here is the link to the most current search results: http://goo.gl/xjGP

Btw, what do you think, is it a good idea - to add such search links to similar sections of Manual?

April 1, 2010

"Guess, who" quest

Our designer just shared the photos of our team members that, by his optinion, express their characters best of all. Definitely a "must see" page, if you'd like to know "who is who" @ our team ;)

Dmitri Maximov talks about our new "Envy" project

Here is the whole story. If you'd like the idea, don't forget to leave a comment there. AFAIK, they spent a lot of time on planning and discussions.