本文整理汇总了C#中Store类的典型用法代码示例。如果您正苦于以下问题:C# Store类的具体用法?C# Store怎么用?C# Store使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Store类属于命名空间,在下文中一共展示了Store类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAll
public IEnumerable<Store> GetAll()
{
List<Store> _stores = new List<Store>();
Store store = new Store();
store.base_url = "http://www.buccaneers.com";
store.id = "1";
store.name = "Bucs";
store.typical_donation = "5%";
_stores.Add(store);
store = new Store();
store.base_url = "http://www.yahoo.com";
store.id = "2";
store.name = "Yahoo";
store.typical_donation = "10%";
_stores.Add(store);
store = new Store();
store.base_url = "http://www.danschocolates.com";
store.id = "144";
store.name = "Dan's Chocolates";
store.typical_donation = "12%";
_stores.Add(store);
return _stores.ToArray();
}
示例2: MainClass
public MainClass()
{
userdir = Path.Combine (
Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
"Monopod");
// check userdir exists, make if not
if (!Directory.Exists (userdir)) {
DirectoryInfo d = Directory.CreateDirectory (userdir);
if ( d == null ) {
// TODO: throw a wobbly
}
}
store = new Store (Path.Combine (userdir, ".monopod.db"), userdir);
if (store.NumberOfChannels == 0) {
store.AddDefaultChannels ();
channels = new ChannelWindow (store);
channels.Show ();
} else {
channels = new ChannelWindow (store);
}
#if USING_IPOD
ipodwindow = new IPodChooseWindow (store);
#endif
InitIcon ();
InitMenu ();
// kick off downloading
store.FetchNextChannel ();
store.FetchNextCast ();
}
示例3: SubsetMandatory_1a
public void SubsetMandatory_1a(Store store)
{
myTestServices.LogValidationErrors("No Errors Found Initially");
ORMModel model = store.ElementDirectory.FindElements<ORMModel>()[0];
Role role_2 = (Role)store.ElementDirectory.GetElement(new Guid("82DF5594-2020-4CA3-8154-FD92EE83F726"));
myTestServices.LogValidationErrors("Intoduce Error: Make a role of supertype mandatory");
using (Transaction t = store.TransactionManager.BeginTransaction("Add simple mandatory constraint"))
{
role_2.IsMandatory = true;
t.Commit();
}
myTestServices.LogValidationErrors("Error Found. Calling Undo to remove error...");
store.UndoManager.Undo();
myTestServices.LogValidationErrors("Error removed with undo.");
myTestServices.LogValidationErrors("Intoduce Error: Make a role of subtype mandatory");
using (Transaction t = store.TransactionManager.BeginTransaction("Add simple mandatory constraint"))
{
role_2.IsMandatory = true;
t.Commit();
}
myTestServices.LogValidationErrors("Error Found. Calling Undo to remove error...");
using (Transaction t = store.TransactionManager.BeginTransaction("Add simple mandatory constraint"))
{
role_2.IsMandatory = false;
t.Commit();
}
myTestServices.LogValidationErrors("Error is removed with changing property value...");
}
示例4: DoValidateCollectionItemSucceedsForUniqueNamedElements
public void DoValidateCollectionItemSucceedsForUniqueNamedElements()
{
Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel));
ServiceContractModel model;
using (Transaction transaction = store.TransactionManager.BeginTransaction())
{
model = store.ElementFactory.CreateElement(ServiceContractModel.DomainClassId) as ServiceContractModel;
ServiceContract contract = store.ElementFactory.CreateElement(ServiceContract.DomainClassId) as ServiceContract;
contract.Name = "Contract Name";
Operation part = store.ElementFactory.CreateElement(Operation.DomainClassId) as Operation;
part.Name = "Part Name";
contract.Operations.Add(part);
TestableOperationElementCollectionValidator target = new TestableOperationElementCollectionValidator();
ValidationResults results = new ValidationResults();
target.TestDoValidateCollectionItem(part, contract, String.Empty, results);
Assert.IsTrue(results.IsValid);
transaction.Commit();
}
}
示例5: XMLIniFile
public XMLIniFile(string aaDocElementname, int aaVersion, Store aaStore)
{
xmldoc = new XmlDocument();
DocElementname = aaDocElementname;
DocElementVersion = aaVersion;
XmlFormat = aaStore;
}
示例6: Main
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
Model model = new Model(typeof(Demo));
model.Write<ExtModel,ExtModelField>();
Store store = new Store(typeof(Demo));
store.Write();
List list = new List(typeof(Demo));
list.Write();
Form form = new Form(typeof(Demo));
form.Write();
Controller controller = new Controller(typeof(Demo));
controller.Write();
Application app = new Application(typeof(Demo));
app.Write();
Console.WriteLine ("This is The End my friend!");
}
示例7: DeleteStore
public bool DeleteStore(Store store)
{
if (store == null) return false;
_unitOfWork.StoreRepository.Delete(store);
_unitOfWork.Save();
return true;
}
示例8: AddPage
public static void AddPage(Store store, string itemGuid, string subProcessGuid)
{
Project dteProject = getDteProject(store, "page");
string defaultNamespace = dteProject.Properties.Item("DefaultNamespace").Value.ToString();
var view = FileTypes.getFileType(FileType.View);
var model = FileTypes.getFileType(FileType.PageModel);
var controller = FileTypes.getFileType(FileType.Controller);
#region Add View
byte[] item = new UTF8Encoding(true).GetBytes(string.Format(view.Content, defaultNamespace, itemGuid.Replace("-", "_")));
string fileName = string.Format("{0}.cshtml", itemGuid.Replace("-", "_"));
AddProcessFile(dteProject, subProcessGuid, view.FolderName, fileName, item, true);
#endregion
#region Add Controller
item = new UTF8Encoding(true).GetBytes(string.Format(controller.Content, defaultNamespace, subProcessGuid.Replace("-", "_"), itemGuid.Replace("-", "_")));
fileName = string.Format("{0}Controller.cs", itemGuid.Replace("-", "_"));
AddController(dteProject, controller.FolderName, fileName, item);
#endregion
#region Add Model
item = new UTF8Encoding(true).GetBytes(string.Format(model.Content, itemGuid.Replace("-", "_"), defaultNamespace));
fileName = string.Format("{0}Model.cs", itemGuid.Replace("-", "_"));
AddProcessFile(dteProject, subProcessGuid, model.FolderName, fileName, item, true);
#endregion
}
示例9: BuildCustomSerializationOmissions
private static Dictionary<DomainClassInfo, object> BuildCustomSerializationOmissions(Store store)
{
Dictionary<DomainClassInfo, object> retVal = new Dictionary<DomainClassInfo, object>();
DomainDataDirectory dataDir = store.DomainDataDirectory;
retVal[dataDir.FindDomainRelationship(ExcludedORMModelElement.DomainClassId)] = null;
return retVal;
}
示例10: PostStore
public async Task<IHttpActionResult> PostStore(Store entity)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
entity.TrackingState = TrackingState.Added;
_dbContext.ApplyChanges(entity);
try
{
await _dbContext.SaveChangesAsync();
}
catch (DbUpdateException)
{
if (_dbContext.Stores.Any(e => e.StoreId == entity.StoreId))
{
return Conflict();
}
throw;
}
await _dbContext.LoadRelatedEntitiesAsync(entity);
entity.AcceptChanges();
return CreatedAtRoute("DefaultApi", new { id = entity.StoreId }, entity);
}
示例11: PutStore
public async Task<IHttpActionResult> PutStore(Store entity)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
_dbContext.ApplyChanges(entity);
try
{
await _dbContext.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!_dbContext.Stores.Any(e => e.StoreId == entity.StoreId))
{
return Conflict();
}
throw;
}
await _dbContext.LoadRelatedEntitiesAsync(entity);
entity.AcceptChanges();
return Ok(entity);
}
示例12: update
// Update Store <store>
public static bool update(Store store)
{
using (DataClasses1DataContext database = new DataClasses1DataContext(Globals.connectionString))
{
var query = from a in database.Stores
where (a.StoreID == store.StoreID)
select a;
foreach (var a in query)
{
a.StoreNum = store.StoreNum;
a.StoreName = store.StoreName;
a.StoreAddress = store.StoreAddress;
a.StoreServiceCharge = store.StoreServiceCharge;
}
try
{
database.SubmitChanges();
return true;
}
catch (Exception e)
{
return false;
}
}
}
示例13: ProcessExists
public static SubProcess ProcessExists(string processGuid, string processFolder)
{
var store = new Store(typeof(CloudCoreArchitectSubProcessDomainModel));
if (Directory.Exists(processFolder))
{
foreach (string file in Directory.GetFiles(processFolder).Where(f => f.IndexOf(".subprocess") > -1).Select(f => f))
{
StreamReader streamReader = File.OpenText(file);
var str = streamReader.ReadToEnd();
streamReader.Close();
if (str.IndexOf(string.Format(@"visioId=""{0}""", processGuid)) > -1)
{
using (Transaction transaction = store.TransactionManager.BeginTransaction("load model and diagram"))
{
SubProcess btProcess = CloudCoreArchitectSubProcessSerializationHelper.Instance.LoadModelAndDiagram(store, file, file + ".diagram", null, null, null);
transaction.Commit();
return btProcess;
}
}
}
}
return null;
}
示例14: should_allow_for_passing_parameters_to_async_actions
public async void should_allow_for_passing_parameters_to_async_actions()
{
var storeReducerReached = 0;
var reducer = new SimpleReducer<List<string>>(() => new List<string> {"a"}).When<SomeAction>((s, e) =>
{
storeReducerReached += 1;
return s;
});
var store = new Store<List<string>>(reducer);
var action1 = store.asyncAction<LoginInfo, int>(async (dispatcher, store2, msg) =>
{
await Task.Delay(300);
Assert.That(msg.username, Is.EqualTo("John"));
dispatcher(new SomeAction());
return 112;
});
var result = await store.Dispatch(action1(new LoginInfo
{
username = "John"
}));
Assert.That(storeReducerReached, Is.EqualTo(1));
Assert.That(result, Is.EqualTo(112));
}
示例15: ConvertStringToLayoutInfo
public LayoutInfo ConvertStringToLayoutInfo(string layoutInfo, Store store)
{
LayoutInfo lInfo = null;
Microsoft.VisualStudio.Modeling.SerializationResult serializationResult = new Microsoft.VisualStudio.Modeling.SerializationResult();
DomainXmlSerializerDirectory directory = this.GetDirectory(store);
System.Text.Encoding encoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
Microsoft.VisualStudio.Modeling.SerializationContext serializationContext = new SerializationContext(directory, "", serializationResult);
this.InitializeSerializationContext(store.DefaultPartition, serializationContext, false);
DomainClassXmlSerializer rootSerializer = directory.GetSerializer(LayoutInfo.DomainClassId);
using(System.Xml.XmlReader reader = System.Xml.XmlReader.Create(new System.IO.StringReader(layoutInfo)) )
{
reader.Read(); // Move to the first node - will be the XmlDeclaration if there is one.
serializationResult.Encoding = encoding;
reader.MoveToContent();
lInfo = rootSerializer.TryCreateInstance(serializationContext, reader, store.DefaultPartition) as LayoutInfo;
rootSerializer.Read(serializationContext, lInfo, reader);
}
return lInfo;
}