本文整理汇总了C#中DataLoadOptions.LoadWith方法的典型用法代码示例。如果您正苦于以下问题:C# DataLoadOptions.LoadWith方法的具体用法?C# DataLoadOptions.LoadWith怎么用?C# DataLoadOptions.LoadWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataLoadOptions
的用法示例。
在下文中一共展示了DataLoadOptions.LoadWith方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostRepoInit
public override void PostRepoInit()
{
var options = new DataLoadOptions();
options.LoadWith<Sat>(s => s.User);
options.LoadWith<User>(u => u.Tags);
_repo.LoadOptions = options;
}
示例2: GetAlgorithms
public IEnumerable<DataTransfer.Algorithm> GetAlgorithms(string platformName) {
roleVerifier.AuthenticateForAnyRole(OKBRoles.OKBAdministrator, OKBRoles.OKBUser);
using (OKBDataContext okb = new OKBDataContext()) {
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Algorithm>(x => x.AlgorithmClass);
dlo.LoadWith<Algorithm>(x => x.DataType);
dlo.LoadWith<Algorithm>(x => x.AlgorithmUsers);
okb.LoadOptions = dlo;
var query = okb.Algorithms.Where(x => x.Platform.Name == platformName);
List<Algorithm> results = new List<Algorithm>();
if (roleVerifier.IsInRole(OKBRoles.OKBAdministrator)) {
results.AddRange(query);
} else {
foreach (var alg in query) {
if (alg.AlgorithmUsers.Count() == 0 || userManager.VerifyUser(userManager.CurrentUserId, alg.AlgorithmUsers.Select(y => y.UserGroupId).ToList())) {
results.Add(alg);
}
}
}
return results.Select(x => Convert.ToDto(x)).ToArray();
}
}
示例3: Command_Should_Parse_Correctly
//[TestMethod()]
public void Command_Should_Parse_Correctly()
{
// ARRANGE
Character toon = null;
InventoryItem invItem = new InventoryItem();
// Get the client's character info
string charName = "Badass";
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Character>(c => c.Account);
dlo.LoadWith<Character>(c => c.Zone);
dlo.LoadWith<Character>(c => c.InventoryItems);
dlo.LoadWith<InventoryItem>(ii => ii.Item);
using (EmuDataContext dbCtx = new EmuDataContext()) {
dbCtx.ObjectTrackingEnabled = false;
dbCtx.LoadOptions = dlo;
toon = dbCtx.Characters.SingleOrDefault(c => c.Name == charName);
}
ZonePlayer zp = new ZonePlayer(1, toon, 1, new Client(new System.Net.IPEndPoint(0x2414188f, 123)));
// ACT
//zp.MsgMgr.ReceiveChannelMessage("someTarget", "!damage /amount:200 /type:3", 8, 0, 100);
zp.MsgMgr.ReceiveChannelMessage("someTarget", "!damage", 8, 0, 100);
// ASSERT
}
示例4: Details
public ActionResult Details(int id)
{
IPFinalDBDataContext finalDB = new IPFinalDBDataContext();
DataLoadOptions ds = new DataLoadOptions();
ds.LoadWith<Work_Package>(wp => wp.Package_Softwares);
ds.LoadWith<Package_Software>(ps => ps.Software_Requirement);
finalDB.LoadOptions = ds;
var pack = (from p in finalDB.Work_Packages
where p.id == id
select p).Single();
//var data = from sr in finalDB.Software_Requirements
// join ps in finalDB.Package_Softwares
// on sr.id equals ps.sr_id
// where ps.wp_id == id
// select sr;
//foreach (var ps in data)
//{
// pack.Package_Softwares.Add(new Package_Software()
// {
// Software_Requirement = ps,
// Work_Package = pack
// });
//}
return View(pack);
}
示例5: GetAthleteClubByTournament
public Inti_AthleteClub GetAthleteClubByTournament(Guid athleteId, Guid tournamentId)
{
using (var db = new IntiDataContext(_connectionString))
{
var dlo = new DataLoadOptions();
dlo.LoadWith<Inti_AthleteClub>(ac => ac.Inti_Club);
dlo.LoadWith<Inti_AthleteClub>(ac => ac.Inti_Position);
dlo.LoadWith<Inti_AthleteClub>(ac => ac.Inti_Athlete);
db.LoadOptions = dlo;
var athleteClubs = from ac in db.Inti_AthleteClub
where ac.AthleteGUID == athleteId &&
ac.Inti_Club.TournamentGUID == tournamentId
select ac;
if(athleteClubs.ToList().Count == 1)
{
var athleteClub = athleteClubs.ToList()[0];
return athleteClub;
}
if (athleteClubs.ToList().Count > 1)
{
throw new ArgumentException("More than one club for the athlete with id {0} in the same tournament.", athleteId.ToString());
}
}
return null;
}
示例6: TaskRepository
public TaskRepository()
{
_dataContext = new DataContextDataContext();
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Task>(t => t.Project);
dlo.LoadWith<Task>(t => t.Priority);
_dataContext.LoadOptions = dlo;
}
示例7: GetDefaultDataLoadOptions
private static DataLoadOptions GetDefaultDataLoadOptions()
{
var lo = new DataLoadOptions();
lo.LoadWith<Document>(c => c.Employee);
lo.LoadWith<Document>(c => c.Employee1);
lo.LoadWith<DocumentTransitionHistory>(c=>c.Employee);
return lo;
}
示例8: GetDefaultDataLoadOptions
private static DataLoadOptions GetDefaultDataLoadOptions()
{
var lo = new DataLoadOptions();
lo.LoadWith<Employee>(c => c.StructDivision);
lo.LoadWith<EmployeeRole>(c => c.Role);
lo.LoadWith<Employee>(c => c.EmployeeRoles);
return lo;
}
示例9: QuoteManager
/// <summary>
/// Quote Manager
/// </summary>
public QuoteManager()
{
db = new BizzyQuoteDataContext(Properties.Settings.Default.BizzyQuoteConnectionString);
var options = new DataLoadOptions();
options.LoadWith<Quote>(q => q.QuoteItems);
options.LoadWith<QuoteItem>(qi => qi.Material);
options.LoadWith<QuoteItem>(qi => qi.Product);
db.LoadOptions = options;
}
示例10: ModelDataContext
public ModelDataContext() :
base(Settings.Default.MyBlogConnectionString, xmlSource)
{
var ds = new DataLoadOptions();
ds.LoadWith<Post>(p => p.Comments);
ds.LoadWith<Post>(p => p.CategoryLinks);
ds.LoadWith<PostCategoryLink>(o => o.PostCategory);
this.LoadOptions = ds;
}
示例11: SettingsRepository
public SettingsRepository()
{
var loadOptions = new DataLoadOptions();
loadOptions.LoadWith<Settings>(s => s.Server);
loadOptions.LoadWith<Settings>(s => s.Language);
loadOptions.LoadWith<Settings>(s => s.PhotoResolution);
_context.LoadOptions = loadOptions;
}
示例12: GetTransits
public static IEnumerable<Transit> GetTransits(string playerName, string password)
{
var db = new DbDataContext();
var dl = new DataLoadOptions();
dl.LoadWith<Transit>(x => x.Fleets);
dl.LoadWith<Fleet>(x => x.FleetShips);
dl.LoadWith<Transit>(x => x.PopulationTransports);
dl.LoadWith<Transit>(x => x.Players);
db.LoadOptions = dl;
return db.Transits.ToList();
}
示例13: AnimationList_Loaded
void AnimationList_Loaded(object sender, RoutedEventArgs e)
{
grdAnimations.DataContext = animationManager;
DataLoadOptions loadOptions = new DataLoadOptions();
loadOptions.LoadWith<Animation>(a => a.AnimationType);
loadOptions.LoadWith<Animation>(a => a.Priority);
loadOptions.LoadWith<Animation>(a => a.SalesDrive);
DbDataContext.MakeNewInstance(loadOptions);
animationManager.AllAnimations = null;
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int personId = 0;
if (Request.QueryString["id"] != null && int.TryParse(TamperProofString.QueryStringDecode(Request.QueryString["id"]), out personId))
{
Ajancy.Kimia_Ajancy db = new Ajancy.Kimia_Ajancy(Public.ConnectionString);
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Ajancy.Person>(p => p.DrivingLicenses);
dlo.LoadWith<Ajancy.Person>(p => p.DriverCertifications);
dlo.LoadWith<Ajancy.DriverCertification>(dc => dc.DriverCertificationCars);
dlo.LoadWith<Ajancy.DriverCertificationCar>(dcc => dcc.CarPlateNumber);
dlo.LoadWith<Ajancy.CarPlateNumber>(cpn => cpn.PlateNumber);
dlo.LoadWith<Ajancy.CarPlateNumber>(cpn => cpn.Car);
dlo.LoadWith<Ajancy.Car>(c => c.FuelCards);
dlo.LoadWith<Ajancy.Car>(c => c.CarType);
db.LoadOptions = dlo;
SetPerson(db.Persons.FirstOrDefault<Ajancy.Person>(p => p.PersonID == personId));
db.Dispose();
}
else
{
Response.Redirect("~/Default.aspx");
}
}
}
示例15: MainPage_Loaded
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
using (CalendarClassEntitiesDataContext dc = new CalendarClassEntitiesDataContext(App.conexionString))
{
App.Context.ListaMateria.Clear();
DataLoadOptions dl = new DataLoadOptions();
dl.LoadWith<Materia>(p => p.Recurso);
dl.LoadWith<Materia>(p => p.Actividads);
dc.LoadOptions = dl;
(from m in dc.Materias select m).ToList().ForEach(p => App.Context.ListaMateria.Add(p));
}
}