bool NFCCommonRedisModule::ConvertVectorToPropertyManager(std::vector<std::string>& vKeyList, std::vector<std::string>& vValueList, NF_SHARE_PTR<NFIPropertyManager> pPropertyManager)
{
	if (vKeyList.size() == vValueList.size())
	{
		for (int i = 0; i < vKeyList.size(); ++i)
		{
			const std::string& strKey = vKeyList[i];
			const std::string& strValue = vValueList[i];
			if (strValue.empty())
			{
				continue;
			}

			NF_SHARE_PTR<NFIProperty> pProperty = pPropertyManager->GetElement(strKey);
			if (!pProperty->GetCache() && !pProperty->GetSave())
			{
				continue;
			}

			if(!pProperty->FromString(strValue))
			{
				//TODO
				//error
			}
		}
	}

    return true;
}
const bool NFCObjectSaveModule::AttachData( const NFIDENTID& self )
{
    NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject(self);
    if (!pObject)
    {
        return false;
    }

    NF_SHARE_PTR<NFMapEx<std::string, std::string> > pSelfData = mtObjectCache.GetElement(self);
    if (!pSelfData)
    {
        return false;
    }

    NF_SHARE_PTR<NFIPropertyManager> pProManager = pObject->GetPropertyManager();
    NF_SHARE_PTR<NFIRecordManager> pRecordManager = pObject->GetRecordManager();

    //assign property value 
    NF_SHARE_PTR<NFIProperty> xProperty = pProManager->First(strName);
    while (xProperty)
    {
        if (xProperty->GetSave())
        {
            NF_SHARE_PTR<std::string> pValue = pSelfData->GetElement(strName);
            if (pValue)
            {
                const std::string& strData = *pValue;
                if (!xProperty->FromString(strData))
                {
                    m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "Load Property fail " + strName , ": " + strData, __FUNCTION__, __LINE__);
                }
                else
                {
                    m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, self, "Load Property success " + strName, ": " + strData, __FUNCTION__, __LINE__);
                }
            }
        }

        strName.clear();
        xProperty = pProManager->Next(strName);
    }

    //assign record value
    NF_SHARE_PTR<NFIRecord> xRecord = pRecordManager->First(strName);
    while (xRecord)
    {
        if (xRecord->GetSave())
        {
            NF_SHARE_PTR<std::string> pValue = pSelfData->GetElement(strName);
            if (pValue)
            {
                const std::string& strData = *pValue;
                NFMsg::PlayerRecordBase xRecordData;
                if (xRecordData.ParseFromString(strData) && xRecordData.record_name() == strName)
                {
                    ConvertPBToRecord(xRecordData, xRecord);
                }
            }
        }

        strName.clear();
        xRecord = pRecordManager->Next(strName);
    }

    mtObjectCache.RemoveElement(self);
    return true;
}