ViewState или Состояние Сесси?
Когда и для чего использовать Сookie?
Для чего Состояние Приложения (HttpApplicationState)?
Замечатьельная статья из MSDN, ответит на многие вопросы и даст обзор испоkьзования разлbчных механизмов для достижения одной цели - отслеживать состояние в промежутках между круговыми путями сервера.
http://msdn.microsoft.com/ru-ru/library/z1hkazw7(v=VS.90).aspx
Также с этой статьи можно перейти на более детальную информация касательно интересующих подходов. Обзор очень информативный и полезный.
пятница, 30 июля 2010 г.
вторник, 27 июля 2010 г.
Использование единого URL для различных поведенческих моделей одной формы в MVC
Помни, Товарищ!
Использование единого URL для различных поведенческих моделей одной формы в MVC (URL то один, но в зависимости от типа HTTP запроса - вызываются различные методы контроллера и различные вьюшки) избавляет от пробелем с закладками на данную страницу и отпроблемы повторной пересылки редактируемой формы.
Оригинал
You might ask – why are we using a single URL and differentiating its behavior via the HTTP verb? Why not just have two separate URLs to handle loading and saving edit changes? For example: /Dinners/Edit/[id] to display the initial form and /Dinners/Save/[id] to handle the form post to save it?
The downside with publishing two separate URLs is that in cases where we post to /Dinners/Save/2, and then need to redisplay the HTML form because of an input error, the end-user will end up having the /Dinners/Save/2 URL in their browser’s address bar (since that was the URL the form posted to). If the end-user bookmarks this redisplayed page to their browser favorites list, or copy/pastes the URL and emails it to a friend, they will end up saving a URL that won’t work in the future (since that URL depends on post values).
By exposing a single URL (like: /Dinners/Edit/[id]) and differentiating the processing of it by HTTP verb, it is safe for end-users to bookmark the edit page and/or send the URL to others.
Источник
Professional ASP.NET MVC 1.0
By Rob Conery, Scott Hanselman, Phil Haack, Scott Guthrie
Использование единого URL для различных поведенческих моделей одной формы в MVC (URL то один, но в зависимости от типа HTTP запроса - вызываются различные методы контроллера и различные вьюшки) избавляет от пробелем с закладками на данную страницу и отпроблемы повторной пересылки редактируемой формы.
Оригинал
You might ask – why are we using a single URL and differentiating its behavior via the HTTP verb? Why not just have two separate URLs to handle loading and saving edit changes? For example: /Dinners/Edit/[id] to display the initial form and /Dinners/Save/[id] to handle the form post to save it?
The downside with publishing two separate URLs is that in cases where we post to /Dinners/Save/2, and then need to redisplay the HTML form because of an input error, the end-user will end up having the /Dinners/Save/2 URL in their browser’s address bar (since that was the URL the form posted to). If the end-user bookmarks this redisplayed page to their browser favorites list, or copy/pastes the URL and emails it to a friend, they will end up saving a URL that won’t work in the future (since that URL depends on post values).
By exposing a single URL (like: /Dinners/Edit/[id]) and differentiating the processing of it by HTTP verb, it is safe for end-users to bookmark the edit page and/or send the URL to others.
Источник
Professional ASP.NET MVC 1.0
By Rob Conery, Scott Hanselman, Phil Haack, Scott Guthrie
понедельник, 26 июля 2010 г.
LINQ2SQL и валидация данных.
Помни, Товарищ!
LINQ2SQL по умолчанию предоставляет валидацию данных на уровне схемы, сгенерированной на основе базы данных. Тоесть, если в таблице присутствует поле типа 'integer', в сгенерированной схеме это поле тоже будет обозначено как 'integer'. И всякие попытки впихнуть в это поле что либо, отдичное от 'integer' - вызовет ошибку компиляции. Что это нам дает? Правильно, базовую защиту данных от "SQL иньекций" на уровне схемы.
LINQ2SQL по умолчанию предоставляет валидацию данных на уровне схемы, сгенерированной на основе базы данных. Тоесть, если в таблице присутствует поле типа 'integer', в сгенерированной схеме это поле тоже будет обозначено как 'integer'. И всякие попытки впихнуть в это поле что либо, отдичное от 'integer' - вызовет ошибку компиляции. Что это нам дает? Правильно, базовую защиту данных от "SQL иньекций" на уровне схемы.
пятница, 23 июля 2010 г.
LINQ2SQL and Transaction
Помни, Товарищ!
LINQ2SQL автоматически оборачивает все измененяи в базе данных в транзакцию!
Что бы ты не насчелкал и не на изменял - все это призойдет в транзакции на SubmitChanges.
Оригинал:
LINQ to SQL automatically wraps all changes in a database transaction – so either all changes happen or none of them do when our куpository saves:
DinnerRepository dinnerRepository = new DinnerRepository();
// Create First Dinner
Dinner newDinner1 = new Dinner();
newDinner1.Title = "Dinner with Scott";
newDinner1.HostedBy = "ScotGu";
newDinner1.ContactPhone = "425-703-8072";
// Create Second Dinner
Dinner newDinner2 = new Dinner();
newDinner2.Title = "Dinner with Bill";
newDinner2.HostedBy = "BillG";
newDinner2.ContactPhone = "425-555-5151";
// Add Dinners to Repository
dinnerRepository.Add(newDinner1);
dinnerRepository.Add(newDinner2);
// Persist Changes
dinnerRepository.Save();
Источник:
Professional ASP.NET MVC 1.0
By Rob Conery, Scott Hanselman, Phil Haack, Scott Guthrie
И сразу вопрос.. А если мне надо провести два SubmitChanges в одной транзакции?
LINQ2SQL автоматически оборачивает все измененяи в базе данных в транзакцию!
Что бы ты не насчелкал и не на изменял - все это призойдет в транзакции на SubmitChanges.
Оригинал:
LINQ to SQL automatically wraps all changes in a database transaction – so either all changes happen or none of them do when our куpository saves:
DinnerRepository dinnerRepository = new DinnerRepository();
// Create First Dinner
Dinner newDinner1 = new Dinner();
newDinner1.Title = "Dinner with Scott";
newDinner1.HostedBy = "ScotGu";
newDinner1.ContactPhone = "425-703-8072";
// Create Second Dinner
Dinner newDinner2 = new Dinner();
newDinner2.Title = "Dinner with Bill";
newDinner2.HostedBy = "BillG";
newDinner2.ContactPhone = "425-555-5151";
// Add Dinners to Repository
dinnerRepository.Add(newDinner1);
dinnerRepository.Add(newDinner2);
// Persist Changes
dinnerRepository.Save();
Источник:
Professional ASP.NET MVC 1.0
By Rob Conery, Scott Hanselman, Phil Haack, Scott Guthrie
И сразу вопрос.. А если мне надо провести два SubmitChanges в одной транзакции?
Подписаться на:
Сообщения (Atom)