本文整理汇总了C#中Store.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Store.Save方法的具体用法?C# Store.Save怎么用?C# Store.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store.Save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BtnCreate_Click
protected void BtnCreate_Click( object sender, EventArgs e )
{
if ( Page.IsValid ) {
Store store = new Store( TxtName.Text );
store.Save();
//Give permissions to the current logged in user
Permissions permissions = PermissionService.Instance.GetCurrentLoggedInUserPermissions();
if ( permissions != null && !permissions.IsUserSuperAdmin ) {
StoreSpecificPermissionType storePermissions = StoreSpecificPermissionType.None;
foreach ( StoreSpecificPermissionType permissionType in Enum.GetValues( typeof( StoreSpecificPermissionType ) ).Cast<StoreSpecificPermissionType>() ) {
storePermissions |= permissionType;
}
permissions.StoreSpecificPermissions.Add( store.Id, storePermissions );
permissions.Save();
}
const string editOrderFilePath = @"macroScripts\tea-commerce\edit-order.cshtml";
if ( File.Exists( HostingEnvironment.MapPath( "~" + Path.DirectorySeparatorChar + editOrderFilePath ) ) ) {
store.UISettings.EditOrderUiFile = editOrderFilePath;
store.Save();
}
if ( store.GeneralSettings.ConfirmationEmailTemplateId != null ) {
const string emailTemplateFile = @"macroScripts\tea-commerce\email-template-confirmation.cshtml";
if ( File.Exists( HostingEnvironment.MapPath( "~" + Path.DirectorySeparatorChar + emailTemplateFile ) ) ) {
EmailTemplate emailTemplate = EmailTemplateService.Instance.Get( store.Id, store.GeneralSettings.ConfirmationEmailTemplateId.Value );
EmailTemplateSettings defaultSettings = emailTemplate.Settings.SingleOrDefault( s => s.LanguageId == null );
if ( defaultSettings != null ) {
defaultSettings.TemplateFile = emailTemplateFile;
}
emailTemplate.Save();
}
}
if ( store.GeneralSettings.PaymentInconsistencyEmailTemplateId != null ) {
const string emailTemplateFile = @"macroScripts\tea-commerce\email-template-payment-inconsistency.cshtml";
if ( File.Exists( HostingEnvironment.MapPath( "~" + Path.DirectorySeparatorChar + emailTemplateFile ) ) ) {
EmailTemplate emailTemplate = EmailTemplateService.Instance.Get( store.Id, store.GeneralSettings.PaymentInconsistencyEmailTemplateId.Value );
EmailTemplateSettings defaultSettings = emailTemplate.Settings.SingleOrDefault( s => s.LanguageId == null );
if ( defaultSettings != null ) {
defaultSettings.TemplateFile = emailTemplateFile;
}
emailTemplate.Save();
}
}
Redirect( WebUtils.GetPageUrl( Constants.Pages.EditStore ) + "?id=" + store.Id );
}
}
示例2: Main
static void Main(string[] args)
{
try
{
var factory = DbProviderFactories.GetFactory("MySql.Data.MySqlClient");
var store = new Store(factory, ConnectionString);
var builder = new StoreBuilder(factory, ConnectionString, new MySqlProvider());
//builder.CreateTable<TypesRecord>();
builder.CreateIndex<TypesRecord>(x => x.Name);
//builder.CreateIndex<TypesRecord>(x => x.Age);
//builder.CreateIndex<TypesRecord>(x => x.DateOfBirth);
var test = new TypesRecord
{
Age = 1337,
DateOfBirth = new DateTime(2011, 10, 09, 08, 07, 6),
Name = "Testing"
};
store.Save(test);
store.GetByProperty<TypesRecord>(x => x.Age, 21);
}
catch (Exception ex)
{
System.Console.WriteLine(ex);
}
System.Console.WriteLine("Done.");
System.Console.ReadKey();
}
示例3: Store
public void Daten_können_gespeichert_und_geladen_werden() {
var daten = new[] {
new Datensatz {Name = "Stefan", Strasse = "Am Bahnhof"},
new Datensatz {Name = "Paul", Strasse = "Drumroad 42"}
};
var sut = new Store();
sut.Save(daten);
var geladeneDaten = sut.Load();
Assert.AreEqual(2, geladeneDaten.Count());
Assert.AreEqual("Stefan", geladeneDaten.ElementAt(0).Name);
Assert.AreEqual("Am Bahnhof", geladeneDaten.ElementAt(0).Strasse);
Assert.AreEqual("Paul", geladeneDaten.ElementAt(1).Name);
Assert.AreEqual("Drumroad 42", geladeneDaten.ElementAt(1).Strasse);
//Assert.AreEqual(new[]{"Stefan", "Paul"}, geladeneDaten.Select(x => x.Name));
//Assert.AreEqual(new[]{"Am Bahnhof", "Drumroad 42"}, geladeneDaten.Select(x => x.Strasse));
}