My MSN

Click OK to add this content

 
Content Preview: rss
-+Database Mirroring
265 days ago
What is mirroring?   Mirroring constantly synchronizes the transaction log of a mirror server with the transaction log of a principal server. The synchronization can be either synchronal to enable high availability , or asynchronal to enable high performance . If set to high availability , a witness server is required. this can be either the principal server itself, or a 3rd server. If a 3rd server is chosen, this ensures more security in case of a failure. To configure mirroring, the mirror server must restore a backup of the principal with NORECOVERY mode. Thus you cannot access the mirror database directly, since it remains in recovery mode. But you can create a snapshot of the mirror to read data. Also, the database must set to full recovery mode. (Note: if you want to have a full working copy of a database, then log shipping or replication is your choice over mirroring) Mirroring requires endpoints (TCP or HTTP) for the principal, the witness and the mirror server. ...
-+SQL Server Management Studio: Copy Database
265 days ago
When you right click any Database in the SSMS, you can access the Copy Database tool: This feature easily allows you to copy or move a database from one server to another or within one server. But before you can do this you need to ensure the following conditions: SQL Server Agent service must be running on the destination server SQL Server Integration Services service must be running on the destination server These services must be running with an account that has at least sysdbadmin rights on the target sql server. The source database must not have an owner that is a local account to the source server (e.g. LocalServer1\Tom), otherwise the transfer will fail. If it is associated with a local account, change the owner, for instance to sa. After the prerequisites are confirmed, you can launch the Copy Database wizard. There are currently two ways to copy or move the database: Use the detach and attach method Use the SQL Management Object Method   Use the SQL ...
-+Contains with the Entity Framework.
269 days ago
Sometimes you need to get a result set for a field that contains any value from an array. The default approach in LINQ would be: from var c in data where array.Contains(c.field) select c; which creates a T-SQL that looks like that: select * from data where data.field in (1,2,3,...) Unfortunately, this would produce an error with EF, since Contains is currently not implemented with .NET 3.5SP1. Therefore, we need a workarround that builds an expression that implements an or for each indiviudal value in the array to be compared against the field: private void button2_Click( object sender, RoutedEventArgs e) {     int [] types = new int [] { 1, 2, 3, 10 };     using (TomsPortal. TomsPortalEntities1 tp = new TomsPortalEntities1 ())     {         var r = from node in tp.Node where node.Taxonomy.Id != 3 where Contains< Node , int >(types) select node; ...
-+Intersection with Linq2SQL
269 days ago
Imagine you have a data table that is specified as followed:     CREATE TABLE MyTable   ArticleId int NOT NULL,   CategoryId int NOT NULL     and you want to return all article ids that interesect with an array of Category Id's using LINQ2SQL.   Here is a solution:   int [] categoryIds = new int [] {29,5201,4}; IQueryable < ObjectNodeView > result = context.MyTable; // make a select for the first category: int firstCategory = categoryIds.First(); result = from a in result where a.CategoryId == firstCategory select a; // now intersect all other categories using a inner join: foreach ( int categoryId in categoryIds.Skip(1)) {    result = from a in result       join a2 in context.MyTable on a.ArticleId equals a2.ArticleId       where a2.CategoryId == categoryId      select a; }
-+Urban legends - Truth or Myth?
270 days ago
Select with EF is always slower than with Linq2SQL This is only true when you leave the default value of ObjectQuery.MergeOption or set it to any other value but MergeOption.NoTracking. However, if you do set this value to MergeOption.NoTracking, a select will be 3 times faster than with LINQ2SQL. The following table compares various scenarios: Method Duration (ms) DataReader 580 DataTable/DataAdapter 2050 Linq2SQL with Tracking 3330 Linq2SQL without Tracking 2550 EDM with MergeOption != NoTracking 4600 EDM with MergeOption = NoTracking 1150 So what you see here is that EDM is the fastest access after DataReader, but also the slowest if tracking is (by default) enabled. Depending on what you do, you might consider to disable Tracking for faster read access, but with the possibility of redundant data in memory.   Linq2Sql supports MS SQL only This is not ...
© 2009 MicrosoftMicrosoft