.NET Micro Framework

06/26/2009 08:01:00 By Felipe Pessoto

Esta versão extremamente leve do framework pode rodar em hardware com apenas 64KB de RAM. O objetivo é levar o .Net para aparelhos eletrônicos como relógios, DVD Players, GPS, etc.

Uma imagem do próprio site mostrando as aplicações:

 

 

Deve ser interessante para a indústria, uma opção leve com recursos e facilidade do .Net

.Net Micro Framework

Livros sobre ASP.NET MVC

06/18/2009 07:55:00 By Felipe Pessoto

Já estão disponíveis alguns livros sobre ASP.NET MVC.

O primeiro a ser lançado foi o ASP.NET MVC Framework Preview e o ASP.NET MVC 1.0 Quickly. Li ambos e fazem uma bela intrução ao MVC. O primeiro é bem curto, 100 páginas, já o Quickly tem 256.

Mas se você ainda está procurando um livro pra ler, aproveite os novos que estão saindo, mais completos, até porque foram escritos pelos criados do ASP.NET MVC. Recomendo o Professional ASP.NET MVC 1.0 e o ASP.NET MVC in Action, pretendo ler ambos também. Eles custam por volta de U$30,00

 

Associando entidades por ID no Entity Framework

06/17/2009 14:33:00 By Felipe Pessoto

Uma dica que pode ajudar muito:

Imagine que temos um relacionamento da tabela Mensagem com a Usuario, normalmente fariamos o seguinte para criar um relacionamento:

Mensagem mens = new Mensagem();
mens.Usuario = from us in contexto.UsuarioSet
where us.Id = 10
select us;

contexto.AddToMensagemSet(mens);
contexto.SaveChanges();


O problema é fazemos uma consulta no banco somente para criar o relacionamento, sendo que já temos a informação necessária para isso, o Id do Usuario.
Existe uma outra forma de fazer isso sem consultar o banco de dados:

Mensagem mens = new Mensagem();
mens.UsuarioReference.EntityKey = new EntityKey("YourEntitiesModel.UsuarioSet", "Id", 10);

contexto.AddToMensagemSet(mens);
contexto.SaveChanges();

Assim economizamos um Select, o que faz a diferença quando temos muitas chamadas

LINQ to SQL - Novidades no .NET 4.0

06/10/2009 12:49:00 By Felipe Pessoto

Já temos informações sobre as novidades que estarão no Linq to SQL do .Net 4.0:

Performance

  • Query plans are reused more often by specifically defining text parameter lengths
  • Identity cache lookups for primary key with single result now includes query.Where(predicate).Single/SingleOrDefault/First/FirstOrDefault
  • Reduced query execution overhead when DataLoadOptions specified (cache lookup considers DataLoadOptions value equivalency – post beta 1)

Usability

  • ITable<T> interface for additional mocking possibilities
  • Contains with enums automatically casts to int or string depending on column type
  • Associations can now specify non-primary-key columns on the other end of the association for updates
  • Support list initialization syntax for queries
  • LinqDataSource now supports inherited entities
  • LinqDataSource support for ASP.NET query extenders added

Query stability

  • Contains now detects self-referencing IQueryable and doesn't cause a stack overflow
  • Skip(0) no longer prevents eager loading
  • GetCommand operates within SQL Compact transactions
  • Exposing Link<T> on a property/field is detected and reported correctly
  • Compiled queries now correctly detect a change in mapping source and throw
  • String.StartsWith, EndsWith and Contains now correctly handles ~ in the search string
  • Now detects multiple active result sets (MARS) better
  • Associations are properly created between entities when using eager loading with Table-Valued Functions (TVFs)
  • Queries that contain sub-queries with scalar projections now work better 

Update stability

  • SubmitChanges no longer silently consumes transaction rollback exceptions
  • SubmitChanges deals with timestamps in a change conflict scenario properly
  • IsDbGenerated now honors renamed properties that don't match underlying column name
  • Server-generated columns and SQL replication/triggers now work instead of throwing SQL exception

General stability

  • Binary types equate correctly after deserialization
  • EntitySet.ListChanged fired when adding items to an unloaded entity set
  • Dispose our connections upon context disposal (ones passed in are untouched)

SQL Metal

  • Foreign key property setter now checks all affected associations not just the first
  • Improved error handling when primary key type not supported
  • Now skips stored procedures containing table-valued parameters instead of aborting process
  • Can now be used against connections that use AttachDbFilename syntax
  • No longer crashes when unexpected data types are encountered

LINQ to SQL class designer

  • Now handles a single anonymously named column in SQL result set
  • Improved error message for associations to nullable unique columns
  • No longer fails when using clauses are added to the partial user class
  • VarChar(1) now correctly maps to string and not char
  • Decimal precision and scale are now emitted correctly in the DbType attributes for stored procedures
  • Foreign key changes will be picked up when bringing tables back into the designer without a restart 

Code generation (SQL Metal + LINQ to SQL class designer)

  • Stored procedures using original values now compiles when the entity and context namespaces differ
  • Virtual internal now generates correct syntax
  • Mapping attributes are now fully qualified to prevent conflicts with user types
  • KnownTypeAttributes are now emitted for DataContractSerializer with inheritance
  • Delay-loaded foreign keys now have the correct, compilable, code generated
  • Using stored procedures with concurrency no longer gets confused if entities in different namespace to context
  • ForeignKeyReferenceAlreadyHasValueException is now thrown if any association is loaded not just the first

 

Potentially breaking changes


We worked very hard to avoid breaking changes but of course any potential bug fix is a breaking change if your application was depending on the wrong behavior. The ones I specifically want to call out are:

Skip(0) is no longer a no-op


The special-casing of 0 for Skip to be a no-op was causing some subtle issues such as eager loading to fail and we took the decision to stop special casing this. This means if you had syntax that was invalid for a Skip greater than 0 it will now also be invalid for skip with a 0. This makes more sense and means your app would break on the first page now instead of subtlety breaking on the second page. Fail fast :)

ForeignKeyReferenceAlreadyHasValue exception


If you are getting this exception where you weren’t previously it means you have an underlying foreign key with multiple associations based on it and you are trying to change the underlying foreign key even though we have associations loaded.Best thing to do here is to set the associations themselves and if you can’t do that make sure they aren’t loaded when you want to set the foreign key to avoid inconsistencies.

 

Fonte: http://damieng.com/blog/2009/06/01/linq-to-sql-changes-in-net-40

ASP.NET MVC 2.0

06/06/2009 23:44:00 By Felipe Pessoto

Enquanto começamos nossas aplicações em ASP.NET MVC, a Microsoft já planeja a versão 2.0. Sim, e pelo que parece pra esse ano, ja que o VS2010 virá com ele.

As novidades são boas, sendo que algumas já estão disponíveis no assembly Futures, como os Helpers fortemente tipados.

O foco será aplicações "enterprise":

"The goal with this release of MVC is to target Enterprise needs both in the area of productivity and requirements. Features such as Areas and AsynchronousController address various needs for enterprise apps, while Paging Helpers, and Strongly Typed helpers address productivity.

Runtime
ASP.NET MVC 2 will take a runtime dependency on ASP.NET 3.5 SP1 as we plan to ship project templates and tooling for both Visual Studio 2008 and Visual Studio 2010. The next major version of ASP.NET MVC after version 2 will likely drop support for Visual Studio 2008 and require the ASP.NET 4 framework.

Visual Studio 2010 
Visual Studio 2010 Beta 1 support as an add-on (Sometime in June) 
Included in Visual Studio 2010 Beta 2 and post Beta 2

Visual Studio 2008 
Will continue to ship a standalone installer for MVC for Visual Studio 2008

ASP.NET MVC 2 Features 
Areas - Provide a means of grouping controllers and views to build out subsections of a site in isolation.
Asynchronous Controller Actions - Provide an asynchronous programming model for controller actions for improved scalability. 
Strongly-typed input helpers – Expression-based helpers for generating form fields against the model. 
Strongly-typed link helpers – strongly typed helpers for generating action links
Support for Data Annotations - The default model binder will include support for Data Annotations attributes (a la Dynamic Data). 
Caching Improvements - Improve various caching scenarios. 
Misc - Various improvements"

http://aspnet.codeplex.com/Wiki/View.aspx?title=Road%20Map