示例#1
0
    private void SaveConfig(IDataConfig config)
    {
        string key  = savePrefix + config.ToString();
        var    json = JsonUtility.ToJson(config);

        PlayerPrefs.SetString(key, json);
    }
示例#2
0
 public LanguageMap(IDataConfig config)
 {
     ToTable(config.TablePrefix + "Languages", config.TableSchema);
     HasKey(e => e.CultureCode);
     Property(e => e.CultureCode)
     .HasColumnType(DbConst.Varchar)
     .HasMaxLength(64);
     Property(e => e.LanguageCode)
     .HasColumnType(DbConst.Varchar)
     .HasMaxLength(64);
     Property(e => e.Name)
     .HasMaxLength(255);
     Property(e => e.LocalizedName)
     .HasMaxLength(255);
     Property(e => e.UpdatedOn)
     .IsRequired();
     Property(e => e.CreatedOn)
     .IsRequired();
     HasRequired(a => a.CreatedBy)
     .WithMany()
     .HasForeignKey(u => u.CreatedByUserId)
     .WillCascadeOnDelete(false);
     HasRequired(a => a.UpdatedBy)
     .WithMany()
     .HasForeignKey(u => u.UpdatedByUserId)
     .WillCascadeOnDelete(false);
 }
示例#3
0
 public LocalizationMap(IDataConfig config)
 {
     ToTable(config.TablePrefix + "Localization", config.TableSchema);
     HasKey(e => e.Id);
     Property(e => e.Code)
     .HasMaxLength(200)
     .IsRequired()
     .HasColumnAnnotation(
         IndexAnnotation.AnnotationName,
         new IndexAnnotation(new IndexAttribute(config.TablePrefix + "UX_Localization_Code_Context_CultureCode", 1)
     {
         IsUnique = true
     }));
     Property(e => e.Context)
     .HasMaxLength(200)
     .HasColumnAnnotation(
         IndexAnnotation.AnnotationName,
         new IndexAnnotation(new IndexAttribute(config.TablePrefix + "UX_Localization_Code_Context_CultureCode", 2)
     {
         IsUnique = true
     }));
     Property(e => e.CultureCode)
     .HasColumnAnnotation(
         IndexAnnotation.AnnotationName,
         new IndexAnnotation(new IndexAttribute(config.TablePrefix + "UX_Localization_Code_Context_CultureCode", 3)
     {
         IsUnique = true
     }));
     Property(e => e.Description)
     .HasMaxLength(255);
 }
示例#4
0
    //public void PreLoad()
    //{
    //    Load<HeroDataConfig>();
    //    Load<ItemDataConfig>();
    //    Load<MonsterDataConfig>();
    //}

    public void Load <T>() where T : IDataConfig
    {
        //todo 改为异步&加密
        Type        t    = typeof(T);
        string      path = GameConstants.AssetBundlePath + "configs/tabledata";
        AssetBundle ab   = AssetBundleSys.Instance.LoadAssetBundleInStreaming(path);
        TextAsset   ta   = ab.LoadAsset <TextAsset>(t.Name + ".json");

        //if (File.Exists("Assets/"+resPath))
        //{
        //string s = Resources.Load<TextAsset>(resPath).text;
        IDataConfig resDataConfig = LitJson.JsonMapper.ToObject <T>(ta.text);

        IList dataList = resDataConfig.GetDataInfoList();
        Dictionary <int, BaseDataInfo> tableData = new Dictionary <int, BaseDataInfo>();

        foreach (BaseDataInfo dataDetail in dataList)
        {
            FieldInfo idFieldinfo = typeof(BaseDataInfo).GetField("Id");
            int       key         = (int)idFieldinfo.GetValue(dataDetail);
            tableData.Add(key, dataDetail);
        }
        _dataConfigs.Add(typeof(T), tableData);
        //}
        //else
        //{
        //    throw new FileNotFoundException("Don't Find Type Res named " + resPath);
        //}
    }
示例#5
0
 public DbVersionMap(IDataConfig config)
 {
     ToTable(config.TablePrefix + "Schemas", config.TableSchema);
     HasKey(e => e.Version);
     Property(e => e.Version)
     .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
     Property(e => e.Name)
     .HasMaxLength(255);
 }
示例#6
0
        public UserMap(IDataConfig config)
        {
            ToTable(config.TablePrefix + "Users", config.TableSchema);
            HasKey(e => e.Id);

            Property(e => e.Username)
            .HasColumnType(DbConst.Varchar)
            .HasMaxLength(32)
            .IsRequired();

            Property(e => e.Firstname)
            .HasMaxLength(32)
            .IsRequired();

            Property(e => e.Lastname)
            .HasMaxLength(32)
            .IsRequired();

            Property(e => e.Password)
            .HasColumnType(DbConst.Varbinary)
            .HasMaxLength(128)
            .IsRequired();

            Property(e => e.Salt)
            .HasColumnType(DbConst.Varbinary)
            .HasMaxLength(128)
            .IsRequired();

            Property(e => e.Email)
            .HasColumnType(DbConst.Varchar)
            .HasMaxLength(255)
            .IsRequired();

            Property(e => e.CreatedOn)
            .IsRequired();

            Property(e => e.UpdatedOn)
            .IsRequired();

            HasRequired(p => p.CreatedBy)
            .WithMany()
            .HasForeignKey(s => s.CreatedByUserId);

            Property(e => e.CreatedByUserId)
            .IsRequired();

            HasRequired(p => p.UpdatedBy)
            .WithMany()
            .HasForeignKey(s => s.UpdatedByUserId);

            Property(e => e.UpdatedByUserId)
            .IsRequired();
        }
        public DbRepository(IDataConfig dataConfig)
            : base("name=" + dataConfig.KeyForConnectionString)
        {
            _dataConfig = dataConfig;

            if (!_isInitialized)
            {
                lock (InitializationLock)
                {
                    if (!_isInitialized)
                    {
                        Database.SetInitializer(new MigrateDatabaseToLatestVersion <DbRepository, DbMigrationsConfig>());
                        _isInitialized = true;
                    }
                }
            }
        }
        public MerchantMap(IDataConfig config)
        {
            ToTable(config.TablePrefix + "Merchants", config.TableSchema);

            HasKey(e => e.Id);

            Property(e => e.Name)
            .HasMaxLength(255)
            .IsRequired();

            Property(e => e.Description).HasMaxLength(255);

            Property(e => e.Status)
            .IsRequired();

            Property(e => e.Description)
            .HasColumnType(DbConst.Varchar)
            .HasMaxLength(255)
            .IsRequired();

            Property(e => e.UpdatedOn)
            .IsRequired();

            Property(e => e.CreatedOn)
            .IsRequired();

            HasRequired(a => a.CreatedBy)
            .WithMany()
            .HasForeignKey(u => u.CreatedByUserId)
            .WillCascadeOnDelete(false);

            HasRequired(a => a.UpdatedBy)
            .WithMany()
            .HasForeignKey(u => u.UpdatedByUserId)
            .WillCascadeOnDelete(false);
        }
示例#9
0
 //[Obsolete("DataBase create method  is off!")]
 public EFRepositoryProvider(IServiceProvider provider)
 {
     m_service_provider = provider;
     m_data_config      = provider.GetService(typeof(IDataConfig)) as IDataConfig;
     Database.EnsureCreated();
 }
示例#10
0
 public ConfigSingle(IDataConfig config)
     : base(config)
 {
 }
示例#11
0
 public ReCheckReviewSvc(IDataConfig dataConfig)
 {
     this._Db = dataConfig;
 }
示例#12
0
 public DataSvc(IDataConfig config)
 {
     _db = config;
 }
示例#13
0
文件: MyShopSvc.cs 项目: HkSuen/House
 public MyShopSvc(IDataConfig data)
 {
     this._db = data;
 }
示例#14
0
 public DailyCheckSvc(IDataConfig DB)
 {
     this.DB = DB;
 }
示例#15
0
 public MerchantSvc(IDataConfig dataConfig)
 {
     this._Db = dataConfig;
 }
示例#16
0
 public UsersSvc(IDataConfig config)
 {
     this._db = config;
 }
示例#17
0
文件: OrderSvc.cs 项目: HkSuen/House
 public OrderSvc(IDataConfig config, IWeChatPaySingle paySingle)
     : base(config)
 {
     _pay = paySingle;
 }
示例#18
0
 public RecheckSvc(IDataConfig DB)
 {
     this.DB = DB;
 }