当前位置: 首页>>代码示例>>C#>>正文


C# EntitySet.First方法代码示例

本文整理汇总了C#中EntitySet.First方法的典型用法代码示例。如果您正苦于以下问题:C# EntitySet.First方法的具体用法?C# EntitySet.First怎么用?C# EntitySet.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EntitySet的用法示例。


在下文中一共展示了EntitySet.First方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Save

        public void Save()
        {
            var es = new EntitySet<sysAppConfig>();
            es.Query("select * from sysAppConfig with(nolock) where UserId=:UserId", Session.UserInfo.UserId);
            sysAppConfig entity = null;
            if (es.Count <= 0)
            {
                entity = es.AddNew();
                entity.Iden = IdenGenerator.NewIden(entity.TableName);
            }
            else
                entity = es.First();

            entity.UserId = Session.UserInfo.UserId;
            entity.AppConfig = XmlSerializerHelper.Serialize<AppConfig>(this);
            es.SaveChanges();
        }
开发者ID:JodenSoft,项目名称:JodenSoft,代码行数:17,代码来源:AppConfig.cs

示例2: ReCreateMenuParam

        private void ReCreateMenuParam()
        {
            var sql = @"
SELECT FileName=b.Name,a.ClassName
FROM dbo.sysBusinessView a WITH(NOLOCK)
LEFT JOIN dbo.sysFile b WITH(NOLOCK) ON a.FileId=b.Iden
WHERE a.Iden=:Iden";

            var viewId = this.ViewModel.MainEntitySet.CurrentEntity.BusinessViewId;
            var esView = new EntitySet<QueryEntity>();
            esView.Query(sql,viewId);
            if (esView.IsEmpty()) return;

            var entity = esView.First();
            var fileName = entity.GetFieldValue<string>("FileName");
            if (fileName.IsEmpty()) return;

            var typeName = entity.GetFieldValue<string>("ClassName");
            if (typeName.IsEmpty()) return;

            var dllFile = Path.Combine(Application.StartupPath, fileName);
            if (!File.Exists(dllFile)) return;

            AppDomain ad = AppDomain.CreateDomain("sysMenuView Test DLL Marked ViewParameterAttribute");
            try
            {
                LoadAssemblyProxyObject obj = (LoadAssemblyProxyObject)ad.CreateInstanceFromAndUnwrap(LoadAssemblyProxyObject.AssemblyFileName, LoadAssemblyProxyObject.ProxyObjectTypeName);

                if (!Path.GetExtension(fileName).Equals(".dll", StringComparison.InvariantCultureIgnoreCase)
                    && !Path.GetExtension(fileName).Equals(".exe", StringComparison.InvariantCultureIgnoreCase)) return;

                obj.LoadAssembly(dllFile);
                var types = obj.GetType(typeName);
                if (types == null) return;

                var list = types.GetAllPropertyMarked<ViewParameterAttribute>();
                if (list.IsEmpty()) return;

                var deleteList = this.ViewModel.MenuParamEntitySet.Where(p => !p.Name.In(list.Select(x => x.Name)));
                foreach (var item in deleteList)
                {
                    item.Delete();
                }

                foreach (var item in list)
                {
                    var attr = item.GetCustomAttribute<ViewParameterAttribute>();

                    var param = this.ViewModel.MenuParamEntitySet.FirstOrDefault(p => p.Name == item.Name);
                    if (param == null)
                    {
                        param = this.ViewModel.MenuParamEntitySet.AddNew();
                        param.Iden = IdenGenerator.NewIden(param.IdenGroup);
                        param.MenuId = this.ViewModel.MainEntitySet.CurrentEntity.Iden;
                        param.Value = string.Empty;
                    }

                    param.Name = item.Name;
                    param.ControlType = (int)attr.ControlType;
                    param.Description = attr.Desctiption;
                    param.Category = attr.Category;
                }
                this.grvParams.RefreshData();
                this.grvParams.BestFitColumns();

            }
            finally
            {
                AppDomain.Unload(ad);
            }
        }
开发者ID:JodenSoft,项目名称:JodenSoft,代码行数:71,代码来源:sysMenuView.cs


注:本文中的EntitySet.First方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。