How to restore user when database is restored.

by mats.decker 24. February 2010 15:04

A thing that always annoys me, when backup-restoring a database between database servers, is the mismatch between the sql login and database login. In some way they have the same name but some id isn't equal so they don't match. Atleast in newer versions of SQL Server you could delete one and re-map it.

Stumbled across this script that matches the server login and database login.

USE [Database]
EXEC sp_change_users_login 'Update_One', 'Username', 'Username'

This only works when the usernames match.

Tags:

blog comments powered by Disqus

Developer lunch: Entity Framework in .NET 4

by mats.decker 13. February 2010 14:10

For "my" developer lunch i selected an awesome session from Microsoft PDC09, called Evolving ADO.NET Entity Framework in .NET 4 and Beyond, where Microsoft's Shyam Pather and Chris Anderson takes us through an hour of as many new features in the new Entity Framework as possible.

Especially interesting is the ability to use POCO-classes (Plain Old CLR Objects) and the "Model first" concept where you remove the dependency to any base classes and begin with the logic tier. Also, with the embedding of LinqToSql into Entity Framework, the rendering of SQL-clauses and implementation of Stored Procedures in the context really takes the data access layer to a new level and remove many pitfalls seen in the past with OR mappers.

Adding to this with the ability to test applications with fake repositories and such i think this is the way to build applications for quite a while.

Tags: , , , , , ,

blog comments powered by Disqus

PDC09 Session - Data Programming and Modeling for the Microsoft .NET Developer

by mats.decker 17. November 2009 23:14

 

Don Box and Chris Anderson went through Entity Framework and the new stuff that has improved the developer experience. For instance you can use Entity Framework and still use IDataReader etc getting the data so you may start migrating from SqlConnection to Entity Framework without committing entirely. That and that you could use your own classes instead of the dal-style generated classes makes this customizable in very powerful way like in a wcf service environment. That and that it looks more nicer.

They also addressed the never ending story about where the framework should be modeled (database, definitions file, C# code) and the answer is ... the way you like it :). It all depends on where the model origins, for an instance if you have an existing database it will be hard to make another model in code.

They also showed the entity framewark talking with Share Point over OData(!) where they could access the data via and atom feed and manipulate that data directly in the share point server. I really have to look into odata!

On another note i really have to see more about 'M' the "data language", which they only talked about peripherally.

 

Tags: , , ,

Development

blog comments powered by Disqus

A very interesting first day at PDC 09 is coming to an end.

by mats.decker 17. November 2009 04:54

We've been here in Los Angeles for a couple of days doing tourist stuff but today we were back to work. And a very interesting day at that. We rather early decided to attend the Windows 7 Developer Boot Camp session to see firsthand the new and updated features of the latest version of Windows. 

After the initial speak of Mark Russinovich, going through general Windows 7 improvements, Arun Kishan and Landy Wang kickstarted the conference with Kernel and Memory changes.

Since i'm a C# developer focusing on web, there were a lot of stuff going over my head with some of the extremely technical stuff but still very interesting to know what goes around below when writing my very high level language code. But in short you should get Windows 7 for clients or upgrade to Windows Server 2008 R2 just for perfomance gain on the same computer :).

Arun addressed redesign of access to and handling of threads and strains. He also talked about core parking, where cores not used enters sleep mode and therefore takes a lot less power to a laptop battery's relief and in a global perspective takes a lot less power from the power grid when a billion computers are not running their two billion plus cores at full effect.

Landy on the other hand talked about how memory managing has changed to being more suspect about application allocation memory in an abusive way, ie when an application tries to allocate like all pages in memory the memory manager lowers the priority of the allocated memory so that smaller applications aren't effected so the only thing running slowly is the abusing program itself. By having it this way Windows 7 allocates a lot of memory to begin with but is's good memory allocation since it gives it to applications that need it. In short this means that it pays of to write good code handling memory stuff nowadays contrary to pre Windows 7 where the good applications were the ones paying for the bad applications' memory handling.

This is only an outtake of their whole presentations but the presentations should be online very soon and every developer should see them.

Tags: , ,

blog comments powered by Disqus

How to log log4net

by mats.decker 14. October 2009 12:37

I had some problems with log4net not logging my site at all. It just created empty(0kB) log files, turned out to be missing write permissions to the log files directory.

But the interesting thing is how i found it by logging log4net by just adding two settings to my web.config file.

<appSettings>
       <add key="log4net.Internal.Debug" value="true"/>
</appSettings>

<system.diagnostics>
       <trace autoflush="true">
              <listeners>
                     <add
                           name="textWriterTraceListener"
                           type="System.Diagnostics.TextWriterTraceListener"
                           initializeData="C:\temp\log4net.txt" />
              </listeners>
       </trace>
</system.diagnostics>

Tags: , , , ,

blog comments powered by Disqus

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 2.5 Sweden License.


Welcome to the Dropit blog!

Here we, the people that work at Dropit, will write about stuff that interests us. For example web development, especially with .NET and EPiServer - but we'll also talk about other techniques that interest us, marketing on the web, social phenomenons, pop culture, games and software development in general.